forked from laysense/laysense.cn
Make catalog and article landing pages editable
This commit is contained in:
@@ -10,6 +10,8 @@ final class BlockTemplates
|
||||
|
||||
public const NETWORK_FEED = '{"categories":["supported-projects","partners"],"mode":"network","limit":30}';
|
||||
|
||||
public const CATALOG_FEED = '{"categories":["services"],"mode":"catalog","limit":30}';
|
||||
|
||||
public const PRODUCT_LINKS = '<div class="hero-directory"><a class="overline directory-label" href="/services">产品与服务</a><a href="/pagepan"><span>PAGEPAN</span><small>可视化建站</small></a><a href="/highspeaker"><span>HighSpeaker DNS</span><small>开源智能解析</small></a><a href="/sc"><span>软著代理</span><small>登记申请与材料服务</small></a><a href="/shnu-sc"><span>SHNU 学生</span><small>软著申请方案</small></a></div>';
|
||||
|
||||
public const ELEMENT_GROUPS = [
|
||||
@@ -72,7 +74,7 @@ final class BlockTemplates
|
||||
'two-actions' => ['双按钮横幅', '<div class="studio-banner studio-banner-two"><div><h3>选择下一步</h3><p>介绍访客可以立即做什么。</p></div><div class="actions"><a class="button button-primary" href="/services">查看服务</a><a class="button button-outline" href="/#contact">联系我们</a></div></div>'],
|
||||
]],
|
||||
'layout' => ['图文与布局', [
|
||||
'image' => ['图文', '<div class="studio-split"><img src="/assets/original/home-hero.webp" alt="" loading="lazy"><div><h3>介绍主题</h3><p>在这里说明图片或产品。</p></div></div>'],
|
||||
'image' => ['产品图文', '<div class="studio-split"><img src="/assets/original/home-hero.webp" alt="" loading="lazy"><div><h3>介绍主题</h3><p>在这里说明图片或产品。</p></div></div>'],
|
||||
'grid' => ['双栏网格', '<div class="studio-two-column"><article class="content-card"><h3>第一栏</h3><p>填写主要内容。</p></article><article class="content-card"><h3>第二栏</h3><p>补充相关信息。</p></article></div>'],
|
||||
]],
|
||||
'media' => ['媒体', [
|
||||
@@ -94,6 +96,7 @@ final class BlockTemplates
|
||||
'pricing' => ['双方案报价', '<div class="card-grid price-grid studio-pricing"><article class="content-card price-card"><h3>基础方案</h3><p class="price-value">填写价格</p><p>填写方案包含的服务。</p><a class="button button-outline" href="/#contact">咨询基础方案</a></article><article class="content-card price-card"><h3>进阶方案</h3><p class="price-value">填写价格</p><p>填写扩展服务或权益。</p><a class="button button-primary" href="/#contact">咨询进阶方案</a></article></div>'],
|
||||
]],
|
||||
'actions' => ['导航与引导', [
|
||||
'service-catalog' => ['产品与服务目录', '', '', self::CATALOG_FEED],
|
||||
'product-links' => ['产品与服务五联导航', self::PRODUCT_LINKS],
|
||||
'navigation' => ['快速导航', '<ul class="studio-quick-nav"><li><a href="/services">产品与服务</a></li><li><a href="/articles">动态与文章</a></li><li><a href="/#contact">联系来笙</a></li></ul>'],
|
||||
'cta' => ['行动按钮', '<p>说明下一步。</p><p><a class="button button-primary" href="#contact">联系来笙</a></p>'],
|
||||
@@ -111,7 +114,17 @@ final class BlockTemplates
|
||||
|
||||
$groups = self::GROUPS;
|
||||
$seed = json_decode(file_get_contents(dirname(__DIR__, 2) . '/resources/seed.json'), true, flags: JSON_THROW_ON_ERROR);
|
||||
$sectionGroups = [
|
||||
'product' => 'layout', 'about' => 'content', 'blog' => 'content',
|
||||
'features' => 'features', 'support' => 'features', 'why' => 'features', 'stories' => 'features',
|
||||
'pricing' => 'details', 'comparison' => 'details', 'materials' => 'details', 'fees' => 'details',
|
||||
'faq' => 'details', 'terms' => 'details',
|
||||
'get' => 'actions', 'options' => 'actions', 'go' => 'actions', 'benefits' => 'layout',
|
||||
];
|
||||
foreach ($seed['pages'] as $page) {
|
||||
if (!in_array($page['slug'], ['home', 'highspeaker', 'sc', 'shnu-sc'], true)) {
|
||||
continue;
|
||||
}
|
||||
$links = '';
|
||||
foreach ($page['actions'] as [$url, $label]) {
|
||||
$links .= '<a class="button button-outline" href="' . View::escape($url) . '">' . View::escape($label) . '</a>';
|
||||
@@ -119,15 +132,20 @@ final class BlockTemplates
|
||||
$hero = '<div class="studio-cover"><img src="' . View::escape($page['image']) . '" alt="' . View::escape($page['alt']) . '" loading="lazy">'
|
||||
. '<div><h3>' . View::escape(trim($page['heading'] . ' ' . $page['accent'])) . '</h3><p>' . View::escape($page['lead'])
|
||||
. '</p><div class="actions">' . $links . '</div></div></div>';
|
||||
$items = ['existing-' . $page['slug'] . '-hero' => ['首屏图文', $hero]];
|
||||
$prefix = 'existing-' . $page['slug'] . '-';
|
||||
$groups['cover'][1][$prefix . 'hero'] = ['产品图文 · ' . $page['name'], $hero];
|
||||
foreach ($page['sections'] as $section) {
|
||||
$items['existing-' . $page['slug'] . '-' . $section['key']] = [
|
||||
$section['title'], Html::sanitize($section['body']), $section['lead'],
|
||||
$group = $sectionGroups[$section['key']] ?? null;
|
||||
if ($group === null) {
|
||||
continue;
|
||||
}
|
||||
$groups[$group][1][$prefix . $section['key']] = [
|
||||
$section['key'] === 'features' ? '特性组' : $section['title'],
|
||||
Html::sanitize($section['body']), $section['lead'],
|
||||
isset($section['feed']) ? Database::json($section['feed']) : null,
|
||||
$section['style'],
|
||||
];
|
||||
}
|
||||
$groups['existing-' . $page['slug']] = ['现有页面 · ' . $page['name'], $items];
|
||||
}
|
||||
|
||||
return $groups;
|
||||
|
||||
@@ -12,7 +12,7 @@ final class SiteDesign
|
||||
public const DEFAULT_HEADER = [
|
||||
'logo' => '/assets/wordmark.webp', 'alt' => 'Laysense 来笙',
|
||||
'links' => [['/', '首页'], ['/services', '产品与服务'], ['/articles', '动态'], ['/#about', '关于来笙']],
|
||||
'button' => ['#contact', '联系来笙'],
|
||||
'button' => ['/contact', '联系来笙'],
|
||||
];
|
||||
|
||||
public const DEFAULT_FOOTER = [
|
||||
@@ -23,7 +23,7 @@ final class SiteDesign
|
||||
'products_title' => '产品与服务',
|
||||
'products' => [['/highspeaker', 'HighSpeaker DNS'], ['/pagepan', 'PAGEPAN'], ['/sc', '软著代理服务']],
|
||||
'company_title' => '公司',
|
||||
'company' => [['/#about', '关于来笙'], ['#contact', '联系来笙']],
|
||||
'company' => [['/#about', '关于来笙'], ['/contact', '联系来笙']],
|
||||
'resources_title' => '资源',
|
||||
'resources' => [['https://git.laysense.com', 'Laysense Git'], ['https://www.layso.de', 'LaySo']],
|
||||
'phones' => [['tel:+16699004532', '+1 (669) 900 4532'], ['tel:+85257012856', '+852 5701 2856']],
|
||||
|
||||
Reference in New Issue
Block a user