Make catalog and article landing pages editable
This commit is contained in:
@@ -48,11 +48,11 @@ $live = count(array_filter($pages, static fn (array $page): bool => $page['statu
|
||||
</section>
|
||||
<section class="admin-panel dashboard-settings" aria-labelledby="quick-title">
|
||||
<h2 id="quick-title">站点编辑</h2>
|
||||
<ul>
|
||||
<li><a href="/admin/settings/header">编辑页头</a></li>
|
||||
<li><a href="/admin/settings/footer">编辑页脚</a></li>
|
||||
<li><a href="/admin/settings/cdn">静态资源 CDN</a></li>
|
||||
<li><a href="/admin/media">打开媒体库</a></li>
|
||||
<ul class="dashboard-setting-buttons">
|
||||
<li><a class="button button-outline" href="/admin/settings/header">编辑页头</a></li>
|
||||
<li><a class="button button-outline" href="/admin/settings/footer">编辑页脚</a></li>
|
||||
<li><a class="button button-outline" href="/admin/settings/cdn">静态资源 CDN</a></li>
|
||||
<li><a class="button button-outline" href="/admin/media">打开媒体库</a></li>
|
||||
</ul>
|
||||
</section>
|
||||
</div>
|
||||
|
||||
@@ -16,7 +16,11 @@ $e = View::escape(...);
|
||||
<a href="<?= $e($categoryLinks[$key]) ?>" <?= $category === (string) $key ? 'aria-current="page"' : '' ?>><?= $e($label) ?></a>
|
||||
<?php endforeach ?>
|
||||
</nav>
|
||||
<?= View::fragment('article-list', ['articles' => $articles, 'categoryScope' => $categoryScope ?? null]) ?>
|
||||
<?php if (!empty($catalog)): ?>
|
||||
<?= View::fragment('service-cards', ['products' => $articles]) ?>
|
||||
<?php else: ?>
|
||||
<?= View::fragment('article-list', ['articles' => $articles, 'categoryScope' => $categoryScope ?? null]) ?>
|
||||
<?php endif ?>
|
||||
<?php if ($pageNumber > 1 || $hasNext): ?>
|
||||
<nav class="pagination" aria-label="动态分页">
|
||||
<?php if ($pageNumber > 1): ?><a class="button button-outline" href="<?= $e(View::archivePage($archivePath, $pageNumber - 1)) ?>" rel="prev">上一页</a><?php endif ?>
|
||||
|
||||
@@ -24,6 +24,7 @@ if ($dynamic && $body === '<p><a class="back-link" href="/articles">查看全部
|
||||
$body = '';
|
||||
}
|
||||
$network = $section['networkFeed'] ?? false;
|
||||
$catalog = $section['catalogFeed'] ?? false;
|
||||
?>
|
||||
<section class="section section-<?= $e($section['style']) ?><?= $network ? ' network' : '' ?>" id="<?= $e($section['key']) ?>" aria-labelledby="heading-<?= $e($section['key']) ?>" <?= $moment ? 'data-moment="iris-opens"' : '' ?><?= $studio ?>>
|
||||
<div class="wrap">
|
||||
@@ -40,6 +41,11 @@ $network = $section['networkFeed'] ?? false;
|
||||
</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 ?>
|
||||
<?php elseif ($catalog): ?>
|
||||
<?= View::fragment('service-cards', ['products' => $section['articleFeed'][0]['articles']]) ?>
|
||||
<?php if ($section['archivePath'] !== null && count($section['articleFeed'][0]['articles']) >= $section['feedLimit']): ?>
|
||||
<p class="article-feed-archive"><a class="back-link" href="<?= $e($section['archivePath']) ?>">查看全部</a></p>
|
||||
<?php endif ?>
|
||||
<?php elseif (!empty($section['articleFeed'])): ?>
|
||||
<?= View::fragment('article-feed', ['groups' => $section['articleFeed'], 'sectionKey' => $section['key'], 'archivePath' => $section['archivePath']]) ?>
|
||||
<?php endif ?>
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
use App\Content\DirectoryCard;
|
||||
use App\Content\Html;
|
||||
use App\Content\View;
|
||||
|
||||
$e = View::escape(...);
|
||||
?>
|
||||
<?php if (!$products): ?><p class="empty-state">暂无可查看的产品和服务。</p><?php endif ?>
|
||||
<div class="catalog-grid">
|
||||
<?php foreach ($products as $product): ?>
|
||||
<?php
|
||||
$card = $product['card'];
|
||||
$body = Html::articleBody($product);
|
||||
$target = DirectoryCard::links($product, $body)['primary'];
|
||||
$extra = $card['extra_url'] ?? '';
|
||||
?>
|
||||
<article class="catalog-card">
|
||||
<?php if (!empty($card['image'])): ?>
|
||||
<div class="catalog-image"><img src="<?= $e($card['image']) ?>" alt="<?= $e($card['alt'] ?? '') ?>" loading="lazy"></div>
|
||||
<?php endif ?>
|
||||
<div class="catalog-content">
|
||||
<?php if (!empty($card['category_label'])): ?><p class="overline"><?= $e($card['category_label']) ?></p><?php endif ?>
|
||||
<h3><?php if ($target !== ''): ?><a href="<?= $e($target) ?>"><?= $e($product['title']) ?></a><?php else: ?><?= $e($product['title']) ?><?php endif ?></h3>
|
||||
<?php if ($product['summary']): ?>
|
||||
<p><?= $e($product['summary']) ?></p>
|
||||
<?php else: ?>
|
||||
<div class="rich"><?= $body ?></div>
|
||||
<?php endif ?>
|
||||
<?php if ($target !== '' || $extra !== ''): ?>
|
||||
<div class="actions">
|
||||
<?php if ($target !== ''): ?><a class="button button-primary" href="<?= $e($target) ?>"><?= $e(($card['label'] ?? '') ?: '了解详情') ?></a><?php endif ?>
|
||||
<?php if ($extra !== '' && $extra !== $target): ?><a href="<?= $e($extra) ?>"><?= $e(($card['extra_label'] ?? '') ?: '相关链接') ?></a><?php endif ?>
|
||||
</div>
|
||||
<?php endif ?>
|
||||
</div>
|
||||
</article>
|
||||
<?php endforeach ?>
|
||||
</div>
|
||||
@@ -1,50 +0,0 @@
|
||||
<?php
|
||||
use App\Content\DirectoryCard;
|
||||
use App\Content\Html;
|
||||
use App\Content\View;
|
||||
|
||||
$e = View::escape(...);
|
||||
?>
|
||||
<section class="section catalog-hero">
|
||||
<div class="wrap">
|
||||
<nav class="breadcrumbs" aria-label="面包屑"><a href="/">首页</a><span aria-hidden="true">/</span><span aria-current="page">产品与服务</span></nav>
|
||||
<h1>产品与服务</h1>
|
||||
<p>自托管建站、开源智能 DNS 与软件著作权代理服务。</p>
|
||||
</div>
|
||||
</section>
|
||||
<section class="section catalog-listing" aria-label="产品与服务目录">
|
||||
<div class="wrap">
|
||||
<?php if (!$products): ?><p class="empty-state">暂无可查看的产品和服务。</p><?php endif ?>
|
||||
<div class="catalog-grid">
|
||||
<?php foreach ($products as $product): ?>
|
||||
<?php
|
||||
$card = $product['card'];
|
||||
$body = Html::articleBody($product);
|
||||
['primary' => $target, 'detail' => $detail] = DirectoryCard::links($product, $body);
|
||||
$extra = $card['extra_url'] ?? '';
|
||||
?>
|
||||
<article class="catalog-card">
|
||||
<?php if (!empty($card['image'])): ?>
|
||||
<div class="catalog-image"><img src="<?= $e($card['image']) ?>" alt="<?= $e($card['alt'] ?? '') ?>" loading="lazy"></div>
|
||||
<?php endif ?>
|
||||
<div class="catalog-content">
|
||||
<?php if (!empty($card['category_label'])): ?><p class="overline"><?= $e($card['category_label']) ?></p><?php endif ?>
|
||||
<h2><?php if ($target !== ''): ?><a href="<?= $e($target) ?>"><?= $e($product['title']) ?></a><?php else: ?><?= $e($product['title']) ?><?php endif ?></h2>
|
||||
<?php if ($product['summary']): ?>
|
||||
<p><?= $e($product['summary']) ?></p>
|
||||
<?php else: ?>
|
||||
<div class="rich"><?= $body ?></div>
|
||||
<?php endif ?>
|
||||
<?php if ($target !== '' || $extra !== ''): ?>
|
||||
<div class="actions">
|
||||
<?php if ($target !== ''): ?><a class="button button-primary" href="<?= $e($target) ?>"><?= $e(($card['label'] ?? '') ?: '了解详情') ?></a><?php endif ?>
|
||||
<?php if ($extra !== '' && $extra !== $target): ?><a href="<?= $e($extra) ?>"><?= $e(($card['extra_label'] ?? '') ?: '相关链接') ?></a><?php endif ?>
|
||||
<?php if ($detail !== '' && $detail !== $extra): ?><a class="catalog-detail" href="<?= $e($detail) ?>">查看详情</a><?php endif ?>
|
||||
</div>
|
||||
<?php endif ?>
|
||||
</div>
|
||||
</article>
|
||||
<?php endforeach ?>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
@@ -2,7 +2,7 @@
|
||||
use App\Content\View;
|
||||
|
||||
$e = View::escape(...);
|
||||
$modes = ($allowOff ? ['off' => '不展示'] : []) + ['merged' => '合并列表', 'tabs' => '分类标签页', 'network' => '项目与伙伴卡片'];
|
||||
$modes = ($allowOff ? ['off' => '不展示'] : []) + ['merged' => '合并列表', 'tabs' => '分类标签页', 'network' => '项目与伙伴卡片', 'catalog' => '产品与服务卡片'];
|
||||
?>
|
||||
<div class="form-grid">
|
||||
<label>展示方式<select name="feed_mode">
|
||||
|
||||
Reference in New Issue
Block a user