forked from laysense/laysense.cn
Audit merged directory links and test rendered fallbacks
This commit is contained in:
+42
-43
@@ -1,43 +1,42 @@
|
||||
<?php
|
||||
use App\Content\View;
|
||||
|
||||
$e = View::escape(...);
|
||||
?>
|
||||
<section class="section network" aria-label="支持项目与合作伙伴">
|
||||
<div class="wrap">
|
||||
<?php if (!$standalone): ?>
|
||||
<div class="section-heading inline-heading">
|
||||
<h2>支持项目与合作伙伴</h2>
|
||||
<a class="button button-outline" href="/network">查看全部</a>
|
||||
</div>
|
||||
<?php endif ?>
|
||||
<?php foreach ($network as $slug => $group): ?>
|
||||
<div class="network-group" id="<?= $e($slug) ?>">
|
||||
<?php if ($standalone): ?><h2><?= $e($group['name']) ?></h2><?php else: ?><h3><?= $e($group['name']) ?></h3><?php endif ?>
|
||||
<?php if (!$group['articles']): ?><p class="empty-state">暂无已发布条目。</p><?php endif ?>
|
||||
<ul class="network-list">
|
||||
<?php foreach ($group['articles'] as $item): ?>
|
||||
<?php
|
||||
// 优先跳卡片配置的网址;没有网址时,只有文章本身有内容才回退到文章页,否则不渲染链接。
|
||||
$card = $item['card'];
|
||||
$articlePath = '/articles/' . $item['slug'];
|
||||
$hasDetail = $item['body'] !== '' || $item['summary'] !== '';
|
||||
$target = ($card['url'] ?? '') ?: ($hasDetail ? $articlePath : '');
|
||||
?>
|
||||
<li>
|
||||
<?php if ($target !== ''): ?><a href="<?= $e($target) ?>"><?php else: ?><span class="network-static"><?php endif ?>
|
||||
<?php if (!empty($card['image'])): ?>
|
||||
<img src="<?= $e($card['image']) ?>" alt="" loading="lazy" width="76" height="28">
|
||||
<?php endif ?>
|
||||
<span><?= $e($item['title']) ?></span>
|
||||
<?php if ($target !== ''): ?></a><?php else: ?></span><?php endif ?>
|
||||
<?php if ($standalone && !empty($card['url']) && $hasDetail): ?>
|
||||
<a class="network-detail" href="<?= $e($articlePath) ?>">查看详情</a>
|
||||
<?php endif ?>
|
||||
</li>
|
||||
<?php endforeach ?>
|
||||
</ul>
|
||||
</div>
|
||||
<?php endforeach ?>
|
||||
</div>
|
||||
</section>
|
||||
<?php
|
||||
use App\Content\DirectoryCard;
|
||||
use App\Content\Html;
|
||||
use App\Content\View;
|
||||
|
||||
$e = View::escape(...);
|
||||
?>
|
||||
<section class="section network" aria-label="支持项目与合作伙伴">
|
||||
<div class="wrap">
|
||||
<?php if (!$standalone): ?>
|
||||
<div class="section-heading inline-heading">
|
||||
<h2>支持项目与合作伙伴</h2>
|
||||
<a class="button button-outline" href="/network">查看全部</a>
|
||||
</div>
|
||||
<?php endif ?>
|
||||
<?php foreach ($network as $slug => $group): ?>
|
||||
<div class="network-group" id="<?= $e($slug) ?>">
|
||||
<?php if ($standalone): ?><h2><?= $e($group['name']) ?></h2><?php else: ?><h3><?= $e($group['name']) ?></h3><?php endif ?>
|
||||
<?php if (!$group['articles']): ?><p class="empty-state">暂无已发布条目。</p><?php endif ?>
|
||||
<ul class="network-list">
|
||||
<?php foreach ($group['articles'] as $item): ?>
|
||||
<?php
|
||||
$card = $item['card'];
|
||||
['primary' => $target, 'detail' => $detail] = DirectoryCard::links($item, Html::articleBody($item));
|
||||
?>
|
||||
<li>
|
||||
<?php if ($target !== ''): ?><a href="<?= $e($target) ?>"><?php else: ?><span class="network-static"><?php endif ?>
|
||||
<?php if (!empty($card['image'])): ?>
|
||||
<img src="<?= $e($card['image']) ?>" alt="" loading="lazy" width="76" height="28">
|
||||
<?php endif ?>
|
||||
<span><?= $e($item['title']) ?></span>
|
||||
<?php if ($target !== ''): ?></a><?php else: ?></span><?php endif ?>
|
||||
<?php if ($standalone && $detail !== ''): ?>
|
||||
<a class="network-detail" href="<?= $e($detail) ?>">查看详情</a>
|
||||
<?php endif ?>
|
||||
</li>
|
||||
<?php endforeach ?>
|
||||
</ul>
|
||||
</div>
|
||||
<?php endforeach ?>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
+50
-48
@@ -1,48 +1,50 @@
|
||||
<?php
|
||||
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'];
|
||||
$hasDetail = $product['body'] !== '' || $product['summary'] !== '';
|
||||
$target = ($card['url'] ?? '') ?: ($hasDetail ? '/articles/' . $product['slug'] : '');
|
||||
?>
|
||||
<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"><?= Html::articleBody($product) ?></div>
|
||||
<?php endif ?>
|
||||
<?php if ($target !== '' || !empty($card['extra_url'])): ?>
|
||||
<div class="actions">
|
||||
<?php if ($target !== ''): ?><a class="button button-primary" href="<?= $e($target) ?>"><?= $e(($card['label'] ?? '') ?: '了解详情') ?></a><?php endif ?>
|
||||
<?php if (!empty($card['extra_url'])): ?><a href="<?= $e($card['extra_url']) ?>"><?= $e(($card['extra_label'] ?? '') ?: '相关链接') ?></a><?php endif ?>
|
||||
</div>
|
||||
<?php endif ?>
|
||||
</div>
|
||||
</article>
|
||||
<?php endforeach ?>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<?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>
|
||||
|
||||
Reference in New Issue
Block a user