forked from laysense/laysense.cn
The services directory built each card title from the backing article, so /services linked to /articles/service-1..4 instead of the product pages the card already carries (PAGEPAN, HighSpeaker, /sc, /shnu-sc). Only the primary button used card.url, which made the title and the button disagree. Use the card URL for both, keeping the article page as fallback for entries without a configured URL, and add a dependency-free regression test.
19 lines
611 B
PHP
19 lines
611 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
require __DIR__ . '/../vendor/autoload.php';
|
|
|
|
use App\Content\Database;
|
|
|
|
// 输出目录类文章:slug<TAB>卡片网址<TAB>是否已发布
|
|
$pdo = Database::connect();
|
|
$query = $pdo->query("SELECT a.slug, a.card, a.status FROM articles a
|
|
WHERE EXISTS (SELECT 1 FROM article_category_links l WHERE l.article_id = a.id
|
|
AND l.category_slug IN ('services', 'supported-projects', 'partners'))
|
|
ORDER BY a.id");
|
|
foreach ($query as $row) {
|
|
$card = json_decode($row['card'], true) ?: [];
|
|
echo $row['slug'], '|', $card['url'] ?? '', '|', $row['status'], "\n";
|
|
}
|