feat(publication): share policy for manifest routes, canonicals, indexing and sitemap

This commit is contained in:
DeCentN2Madness committed 2026-10-07 12:09:06 -07:00
1 parent ea2f1eaa05
commit cd097d0e76
40 files changed
+846 -282

No files matched your search

+2 -17
View File
@@ -1,23 +1,8 @@
---
import { getCollection } from 'astro:content';
import { getPublicationManifest } from '../utils/publication';
const pathname = Astro.url.pathname.replace(/\/$/, '') || '/';
const bare = pathname.replace(/^\/(ar|es)(?=\/|$)/, '') || '/';
const pages = await getCollection('pages', ({ data }) => !data.draft);
const posts = await getCollection('blog', ({ data }) => !data.draft);
const available = new Set<string>(['/', '/library', '/es', '/es/library', '/ar', '/ar/library']);
for (const entry of pages) {
const prefix = entry.data.lang === 'en' ? '' : `/${entry.data.lang}`;
const route = entry.data.slug === 'index'
? prefix || '/'
: entry.data.slug === 'library'
? `${prefix}/library`
: `${prefix}/${entry.data.slug}`;
available.add(route);
}
for (const entry of posts) {
const prefix = entry.data.lang === 'en' ? '' : `/${entry.data.lang}`;
available.add(`${prefix}/library/${entry.data.slug}`);
}
const available = new Set((await getPublicationManifest()).filter((page) => page.eligible).map((page) => page.route));
const langMeta: Record<string, { short: string; full: string }> = {
en: { short: 'EN', full: 'English' },