feat(media): hidden 标签过滤与指南 public/media 约定(T5 补)
- 首页/归档/RSS(zh+en)集合查询统一 draft+hidden 双过滤——样张
永久保留为可访问不列出的活样例(回归测试资产)
- 写作指南视音频段更正:raw HTML 相对路径不走资产管线(实测),
媒体放 public/media/{slug}/ 用绝对 /media/ 引用,与仓外 store
同命名空间
验证: pnpm astro build exit 0(hidden 过滤后样张退出列表与 RSS)
Spec: 2026-10-25_add-media-and-polish
Co-authored-by: GLM-5.3
This commit is contained in:
1 parent
dcc20e9fb3
commit
71a799bd97
9 files changed
+82
-18
No files matched your search
@@ -7,7 +7,7 @@ import { trackOf } from '../../content.config';
|
||||
|
||||
// URL = /archives/{slug},slug 即文件名,与 Halo 旧结构 1:1(不可改)
|
||||
export async function getStaticPaths() {
|
||||
const posts = (await getCollection('posts', ({ data }) => !data.draft)).sort(
|
||||
const posts = (await getCollection('posts', ({ data }) => !data.draft && !data.tags.includes('hidden'))).sort(
|
||||
(a, b) => b.data.pubDate.getTime() - a.data.pubDate.getTime(),
|
||||
);
|
||||
return posts.map((entry, i) => ({
|
||||
|
||||
@@ -4,7 +4,7 @@ import { getCollection } from 'astro:content';
|
||||
import BaseLayout from '../../layouts/BaseLayout.astro';
|
||||
import PostList from '../../components/PostList.astro';
|
||||
|
||||
const posts = (await getCollection('posts', ({ data }) => !data.draft)).sort(
|
||||
const posts = (await getCollection('posts', ({ data }) => !data.draft && !data.tags.includes('hidden'))).sort(
|
||||
(a, b) => b.data.pubDate.getTime() - a.data.pubDate.getTime(),
|
||||
);
|
||||
---
|
||||
|
||||
@@ -8,7 +8,7 @@ import AiTranslatedBadge from '../../../components/AiTranslatedBadge.astro';
|
||||
import { t } from '../../../i18n/ui';
|
||||
|
||||
export async function getStaticPaths() {
|
||||
const zh = (await getCollection('posts', ({ data }) => !data.draft)).sort(
|
||||
const zh = (await getCollection('posts', ({ data }) => !data.draft && !data.tags.includes('hidden'))).sort(
|
||||
(a, b) => b.data.pubDate.getTime() - a.data.pubDate.getTime(),
|
||||
);
|
||||
const en = new Map((await getCollection('postsEn')).map((e) => [e.id, e]));
|
||||
|
||||
@@ -9,7 +9,7 @@ import ProjectWall from '../../components/geek/ProjectWall.astro';
|
||||
import Heatmap from '../../components/geek/Heatmap.astro';
|
||||
import { t } from '../../i18n/ui';
|
||||
|
||||
const posts = (await getCollection('posts', ({ data }) => !data.draft)).sort(
|
||||
const posts = (await getCollection('posts', ({ data }) => !data.draft && !data.tags.includes('hidden'))).sort(
|
||||
(a, b) => b.data.pubDate.getTime() - a.data.pubDate.getTime(),
|
||||
);
|
||||
// 列表标题吃 postsEn 译题(缺译回退 zh,与 /en/archives 同策略)
|
||||
|
||||
@@ -5,7 +5,7 @@ import type { APIContext } from 'astro';
|
||||
// 英文 RSS:postsEn 全量;标题缺译时回退 zh 标题(与 /en/ 页同策略)
|
||||
export async function GET(context: APIContext) {
|
||||
const en = new Map((await getCollection('postsEn')).map((e) => [e.id, e]));
|
||||
const posts = (await getCollection('posts', ({ data }) => !data.draft)).sort(
|
||||
const posts = (await getCollection('posts', ({ data }) => !data.draft && !data.tags.includes('hidden'))).sort(
|
||||
(a, b) => b.data.pubDate.valueOf() - a.data.pubDate.valueOf(),
|
||||
);
|
||||
return rss({
|
||||
|
||||
@@ -8,7 +8,7 @@ import ProjectWall from '../components/geek/ProjectWall.astro';
|
||||
import Heatmap from '../components/geek/Heatmap.astro';
|
||||
import { t } from '../i18n/ui';
|
||||
|
||||
const posts = (await getCollection('posts', ({ data }) => !data.draft)).sort(
|
||||
const posts = (await getCollection('posts', ({ data }) => !data.draft && !data.tags.includes('hidden'))).sort(
|
||||
(a, b) => b.data.pubDate.getTime() - a.data.pubDate.getTime(),
|
||||
);
|
||||
// 最新影像取集合前 4 张;照片时间序由照片管线(exif 车道)治理,此处只裁切
|
||||
|
||||
@@ -4,7 +4,7 @@ import type { APIContext } from 'astro';
|
||||
|
||||
// RSS:posts 集合全量(draft 排除);Phase 3 起双语各出一路(/rss.xml 与 /en/rss.xml)
|
||||
export async function GET(context: APIContext) {
|
||||
const posts = (await getCollection('posts', ({ data }) => !data.draft))
|
||||
const posts = (await getCollection('posts', ({ data }) => !data.draft && !data.tags.includes('hidden')))
|
||||
.sort((a, b) => b.data.pubDate.valueOf() - a.data.pubDate.valueOf());
|
||||
return rss({
|
||||
title: 'wait4x',
|
||||
|
||||
Reference in new issue
Block a user