Migrate the Laysense production snapshot to LaySite 1.3

This commit is contained in:
2026-11-26 00:26:48 +08:00
parent 250a67af94
commit 89f363186b
80 changed files with 491 additions and 29 deletions
+5 -4
View File
@@ -6,7 +6,7 @@ use App\Content\DesignLibrary;
$e = View::escape(...);
$canonical = $path !== null && empty($previewMode) ? View::absolute($path) : null;
$imageUrl = !empty($socialImage) ? Assets::url($socialImage, $cdn) : '';
$imageUrl = Assets::url(($socialImage ?? '') ?: '/assets/original/home-hero.webp', $cdn);
if (str_starts_with($imageUrl, '/')) {
$imageUrl = View::absolute($imageUrl);
}
@@ -21,7 +21,7 @@ $showFooter = $page['visibility']['footer'] ?? true;
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title><?= $e($title) ?></title>
<link rel="icon" href="<?= $e(Assets::DEFAULT_ICON) ?>" type="image/webp">
<link rel="icon" href="<?= $e(Assets::SITE_ICON) ?>" type="image/png">
<meta name="description" content="<?= $e($description) ?>">
<meta name="theme-color" content="#f5f7fb">
<?php if ($canonical): ?>
@@ -36,7 +36,7 @@ $showFooter = $page['visibility']['footer'] ?? true;
<meta property="og:description" content="<?= $e($description) ?>">
<?php if ($imageUrl !== ''): ?>
<meta property="og:image" content="<?= $e($imageUrl) ?>">
<meta property="og:image:alt" content="<?= $e($socialAlt ?? '') ?>">
<meta property="og:image:alt" content="<?= $e(($socialAlt ?? '') ?: '来笙 Laysense') ?>">
<?php endif ?>
<?php if (isset($article)): ?>
<meta property="article:published_time" content="<?= $e(View::date($article['published_at'], DATE_ATOM)) ?>">
@@ -44,13 +44,14 @@ $showFooter = $page['visibility']['footer'] ?? true;
<?php endif ?>
<meta name="twitter:card" content="summary_large_image">
<link rel="stylesheet" href="/assets/site.css">
<link rel="stylesheet" href="/assets/laysense.css">
<?php if (!empty($canvas) || str_contains($content . ($headerMarkup ?? '') . ($footerMarkup ?? ''), 'studio-style-')): ?><link rel="stylesheet" href="<?= $e(CanvasStyle::stylesheetUrl()) ?>"><?php endif ?>
<?php if ($theme !== ''): ?><link rel="stylesheet" href="/assets/page-themes.css"><?php endif ?>
<?php if ($palette): ?><link rel="stylesheet" data-page-palette href="/palette/<?= $e($palette['id']) ?>.css?v=<?= $e($palette['version']) ?>"><?php endif ?>
<script src="<?= $e(Assets::JQUERY) ?>" defer></script>
<script src="/assets/site.js" defer></script>
</head>
<body>
<body<?= in_array($page['slug'] ?? '', ['sc', 'shnu-sc'], true) ? ' class="copyright-service"' : '' ?>>
<a class="skip-link" href="#main-content">跳到内容</a>
<?php if (empty($page['layout_kind']) && ($showHeader || !empty($canvas))): ?>
<?php if (isset($headerMarkup)): ?><div role="banner" data-site-area="header"<?= $showHeader ? '' : ' hidden' ?>><?= $headerMarkup ?></div>
+12
View File
@@ -0,0 +1,12 @@
<svg class="home-pipe-flow" viewBox="0 0 640 480" aria-hidden="true" focusable="false">
<defs>
<path id="hero-pipe-tower" pathLength="100" d="M174 347 241 312 Q246 310 246 305 L246 299 Q246 295 252 293 L273 282"/>
<path id="hero-pipe-disk" pathLength="100" d="M409 282 428 293 Q433 296 433 300 L433 304 Q433 307 438 309 L500 337"/>
<path id="hero-pipe-node" pathLength="100" d="M119 201 125 205 Q129 207 129 212 L129 214 Q130 217 134 219 L190 243"/>
<path id="hero-pipe-chart" pathLength="100" d="M443 226 471 213 Q478 208 483 209 L488 207 Q492 205 492 200 L492 182"/>
</defs>
<g class="home-pipe-route"><use href="#hero-pipe-tower"/><use href="#hero-pipe-tower"/></g>
<g class="home-pipe-route"><use href="#hero-pipe-disk"/><use href="#hero-pipe-disk"/></g>
<g class="home-pipe-route"><use href="#hero-pipe-node"/><use href="#hero-pipe-node"/></g>
<g class="home-pipe-route"><use href="#hero-pipe-chart"/><use href="#hero-pipe-chart"/></g>
</svg>

After

Width:  |  Height:  |  Size: 1004 B

+11 -3
View File
@@ -1,10 +1,12 @@
<?php
use App\Content\Buttons;
use App\Content\CanvasStyle;
use App\Content\PageTemplates;
use App\Content\View;
$e = View::escape(...);
$home = $page['slug'] === 'home';
$service = in_array($page['slug'], ['sc', 'shnu-sc'], true);
$shared = !empty($page['layout_kind']);
$system = ($page['page_type'] ?? 'page') !== 'page';
$showHero = $page['visibility']['hero'] ?? true;
@@ -38,7 +40,7 @@ $field = static fn (string $name): string => $canvas ? ' data-studio-field="' .
<?php else: ?>
<p class="overline hero-label"><?= $e($site['name']) ?></p>
<?php endif ?>
<h1<?= isset($alignments['heading']) ? ' class="' . trim(View::alignmentClass($alignments['heading'])) . '"' : '' ?><?= $alignField('heading') ?>><span class="hero-heading-primary<?= $style('heading') ?>"<?= $field('heading') ?><?= $styleField('heading') ?>><?= $text('heading', $page['heading']) ?></span><?php if ($canvas): ?><span class="studio-accent<?= $style('accent') ?>"<?= $field('accent') ?><?= $styleField('accent') ?>><?= $text('accent', $page['accent']) ?></span><?php elseif ($page['accent'] !== ''): ?><br><span class="<?= trim($style('accent')) ?>"><?= $text('accent', $page['accent']) ?></span><?php endif ?></h1>
<h1<?= isset($alignments['heading']) ? ' class="' . trim(View::alignmentClass($alignments['heading'])) . '"' : '' ?><?= $alignField('heading') ?>><span class="hero-heading-primary<?= $style('heading') ?>"<?= $field('heading') ?><?= $styleField('heading') ?>><?= $text('heading', $page['heading']) ?></span><?php if ($canvas): ?><span class="studio-accent<?= $style('accent') ?>"<?= $field('accent') ?><?= $styleField('accent') ?>><?= $text('accent', $page['accent']) ?></span><?php elseif ($page['accent'] !== ''): ?><br><span class="<?= trim($style('accent')) ?>"><?= $text('accent', $page['accent']) ?></span><?php endif ?><?php if ($home && !$canvas): ?><span class="home-cursor" aria-hidden="true">_</span><?php endif ?></h1>
<p class="hero-lead<?= View::alignmentClass($alignments['lead'] ?? null) ?><?= $style('lead') ?>"<?= $field('lead') ?><?= $alignField('lead') ?><?= $styleField('lead') ?>><?= $text('lead', $page['lead']) ?></p>
<div class="actions hero-actions<?= View::alignmentClass($alignments['actions'] ?? null) ?><?= $style('actions') ?>"<?= $alignField('actions') ?><?= $styleField('actions') ?>>
<?php foreach (Buttons::validate($page['actions']) as $index => [$url, $label, $buttonStyle, $blank]): ?>
@@ -48,8 +50,9 @@ $field = static fn (string $name): string => $canvas ? ' data-studio-field="' .
</div>
</div>
<?php if ($canvas || $page['image'] !== ''): ?>
<div class="hero-visual app-frame<?= $page['image_scale'] ? ' studio-media-' . $e($page['image_scale']) : '' ?><?= View::alignmentClass($alignments['image'] ?? null) ?><?= $style('image') ?>" data-visual<?= $alignField('image') ?><?= $styleField('image') ?><?= $page['image'] === '' ? ' hidden' : '' ?>>
<div class="hero-visual <?= $home ? 'hero-illustration' : ($service ? 'app-frame hero-service-art' : 'app-frame') ?><?= $page['image_scale'] ? ' studio-media-' . $e($page['image_scale']) : '' ?><?= View::alignmentClass($alignments['image'] ?? null) ?><?= $style('image') ?>" data-visual<?= $alignField('image') ?><?= $styleField('image') ?><?= $page['image'] === '' ? ' hidden' : '' ?>>
<img<?= $page['image'] === '' ? '' : ' src="' . $e($page['image']) . '"' ?> alt="<?= $e($page['alt']) ?>" width="1448" height="1086" fetchpriority="high"<?= $canvas ? ' data-studio-hero-image' : '' ?>>
<?php if ($home && !$canvas && $page['image'] === '/assets/original/home-hero.webp'): ?><?= View::fragment('laysense-home-motion') ?><?php endif ?>
</div>
<?php endif ?>
</div>
@@ -71,9 +74,14 @@ $field = static fn (string $name): string => $canvas ? ' data-studio-field="' .
<?php endif ?>
<?php foreach ($page['sections'] as $section): ?>
<?php if ($section['style'] !== 'hero-links'): ?>
<?= View::fragment('section', ['section' => $section, 'moment' => false, 'canvas' => $canvas, 'pageSlug' => $page['slug']]) ?>
<?= View::fragment('section', ['section' => $section, 'moment' => $home && $section['key'] === 'about', 'canvas' => $canvas, 'pageSlug' => $page['slug']]) ?>
<?php endif ?>
<?php endforeach ?>
<?php if ($showHero && ($credit = PageTemplates::photoCredit($page['image']))): ?>
<p class="wrap page-photo-credit">摄影 <a href="<?= $e($credit[2]) ?>"><?= $e($credit[0]) ?></a> ·
<?php if ($credit[3]): ?><a href="<?= $e($credit[3]) ?>"><?= $e($credit[1]) ?></a><?php else: ?><?= $e($credit[1]) ?><?php endif ?>
</p>
<?php endif ?>
<?php if ($canvas): ?>
<?php if ($shared): ?>
<p class="wrap studio-layout-empty" data-studio-empty-layout hidden>从「组件」添加版式,或在页面设置中显示首屏。</p>
+2 -2
View File
@@ -48,10 +48,10 @@ $catalog = $section['catalogFeed'] ?? false;
</div>
<?php if ($network): ?>
<?php foreach ($section['articleFeed'] as $group): ?>
<?php $slug = $group['categories'][0]; $anchor = ($pageSlug ?? '') === 'home' && $section['key'] === 'network' ? $slug : $section['key'] . '-group-' . $slug; ?>
<?php $slug = $group['categories'][0]; $anchor = in_array($pageSlug ?? '', ['home', 'network'], true) && $section['key'] === 'network' ? $slug : $section['key'] . '-group-' . $slug; ?>
<div class="network-group" id="<?= $e($anchor) ?>">
<h3><?= $e($group['label']) ?></h3>
<?= View::fragment('network-items', ['articles' => $group['articles'], 'standalone' => false]) ?>
<?= View::fragment('network-items', ['articles' => $group['articles'], 'standalone' => ($pageSlug ?? '') === 'network']) ?>
</div>
<?php endforeach ?>
<?php if ($section['archivePath'] !== null): ?><p class="article-feed-archive"><a class="back-link" href="<?= $e($section['archivePath']) ?>">查看全部</a></p><?php endif ?>