better sitemap organization

This commit is contained in:
nicolas arduin 2024-12-29 14:49:35 +01:00
parent b2b6887fdf
commit 65c6003313
7 changed files with 57 additions and 27 deletions

View File

@ -26,7 +26,7 @@
"type": { "type": {
"type": "string" "type": "string"
}, },
"permalink": { "slug": {
"type": "string" "type": "string"
}, },
"createdAt": { "createdAt": {
@ -51,7 +51,7 @@
"lang", "lang",
"tags", "tags",
"type", "type",
"permalink", "slug",
"createdAt" "createdAt"
], ],
"additionalProperties": false "additionalProperties": false

View File

@ -26,7 +26,7 @@
"type": { "type": {
"type": "string" "type": "string"
}, },
"permalink": { "slug": {
"type": "string" "type": "string"
}, },
"createdAt": { "createdAt": {
@ -51,7 +51,7 @@
"lang", "lang",
"tags", "tags",
"type", "type",
"permalink", "slug",
"createdAt" "createdAt"
], ],
"additionalProperties": false "additionalProperties": false

View File

@ -20,7 +20,7 @@
"en" "en"
] ]
}, },
"permalink": { "slug": {
"type": "string" "type": "string"
}, },
"tags": { "tags": {
@ -50,7 +50,7 @@
"subtitle", "subtitle",
"url", "url",
"lang", "lang",
"permalink", "slug",
"tags", "tags",
"createdAt" "createdAt"
], ],

View File

@ -6,13 +6,9 @@ export default new Map([
["src/content/articles/en/video-compression.mdx", () => import("astro:content-layer-deferred-module?astro%3Acontent-layer-deferred-module=&fileName=src%2Fcontent%2Farticles%2Fen%2Fvideo-compression.mdx&astroContentModuleFlag=true")], ["src/content/articles/en/video-compression.mdx", () => import("astro:content-layer-deferred-module?astro%3Acontent-layer-deferred-module=&fileName=src%2Fcontent%2Farticles%2Fen%2Fvideo-compression.mdx&astroContentModuleFlag=true")],
["src/content/fragments/en/image-full.mdx", () => import("astro:content-layer-deferred-module?astro%3Acontent-layer-deferred-module=&fileName=src%2Fcontent%2Ffragments%2Fen%2Fimage-full.mdx&astroContentModuleFlag=true")], ["src/content/fragments/en/image-full.mdx", () => import("astro:content-layer-deferred-module?astro%3Acontent-layer-deferred-module=&fileName=src%2Fcontent%2Ffragments%2Fen%2Fimage-full.mdx&astroContentModuleFlag=true")],
["src/content/fragments/en/super-cookies.mdx", () => import("astro:content-layer-deferred-module?astro%3Acontent-layer-deferred-module=&fileName=src%2Fcontent%2Ffragments%2Fen%2Fsuper-cookies.mdx&astroContentModuleFlag=true")], ["src/content/fragments/en/super-cookies.mdx", () => import("astro:content-layer-deferred-module?astro%3Acontent-layer-deferred-module=&fileName=src%2Fcontent%2Ffragments%2Fen%2Fsuper-cookies.mdx&astroContentModuleFlag=true")],
["src/content/fragments/fr/image-full.mdx", () => import("astro:content-layer-deferred-module?astro%3Acontent-layer-deferred-module=&fileName=src%2Fcontent%2Ffragments%2Ffr%2Fimage-full.mdx&astroContentModuleFlag=true")],
["src/content/fragments/fr/buttons.mdx", () => import("astro:content-layer-deferred-module?astro%3Acontent-layer-deferred-module=&fileName=src%2Fcontent%2Ffragments%2Ffr%2Fbuttons.mdx&astroContentModuleFlag=true")],
["src/content/articles/fr/sci-hub-blocage.mdx", () => import("astro:content-layer-deferred-module?astro%3Acontent-layer-deferred-module=&fileName=src%2Fcontent%2Farticles%2Ffr%2Fsci-hub-blocage.mdx&astroContentModuleFlag=true")], ["src/content/articles/fr/sci-hub-blocage.mdx", () => import("astro:content-layer-deferred-module?astro%3Acontent-layer-deferred-module=&fileName=src%2Fcontent%2Farticles%2Ffr%2Fsci-hub-blocage.mdx&astroContentModuleFlag=true")],
["src/content/fragments/fr/super-cookies.mdx", () => import("astro:content-layer-deferred-module?astro%3Acontent-layer-deferred-module=&fileName=src%2Fcontent%2Ffragments%2Ffr%2Fsuper-cookies.mdx&astroContentModuleFlag=true")], ["src/content/fragments/fr/buttons.mdx", () => import("astro:content-layer-deferred-module?astro%3Acontent-layer-deferred-module=&fileName=src%2Fcontent%2Ffragments%2Ffr%2Fbuttons.mdx&astroContentModuleFlag=true")],
["src/content/fragments/fr/image-full.mdx", () => import("astro:content-layer-deferred-module?astro%3Acontent-layer-deferred-module=&fileName=src%2Fcontent%2Ffragments%2Ffr%2Fimage-full.mdx&astroContentModuleFlag=true")],
["src/content/articles/fr/the-day-I-jamd.mdx", () => import("astro:content-layer-deferred-module?astro%3Acontent-layer-deferred-module=&fileName=src%2Fcontent%2Farticles%2Ffr%2Fthe-day-I-jamd.mdx&astroContentModuleFlag=true")], ["src/content/articles/fr/the-day-I-jamd.mdx", () => import("astro:content-layer-deferred-module?astro%3Acontent-layer-deferred-module=&fileName=src%2Fcontent%2Farticles%2Ffr%2Fthe-day-I-jamd.mdx&astroContentModuleFlag=true")],
["src/content/articles/en/en-after-effects-expressions.mdx", () => import("astro:content-layer-deferred-module?astro%3Acontent-layer-deferred-module=&fileName=src%2Fcontent%2Farticles%2Fen%2Fen-after-effects-expressions.mdx&astroContentModuleFlag=true")], ["src/content/fragments/fr/super-cookies.mdx", () => import("astro:content-layer-deferred-module?astro%3Acontent-layer-deferred-module=&fileName=src%2Fcontent%2Ffragments%2Ffr%2Fsuper-cookies.mdx&astroContentModuleFlag=true")]]);
["src/content/articles/en/en-sci-hub-blocage.mdx", () => import("astro:content-layer-deferred-module?astro%3Acontent-layer-deferred-module=&fileName=src%2Fcontent%2Farticles%2Fen%2Fen-sci-hub-blocage.mdx&astroContentModuleFlag=true")],
["src/content/articles/en/en-the-day-I-jamd.mdx", () => import("astro:content-layer-deferred-module?astro%3Acontent-layer-deferred-module=&fileName=src%2Fcontent%2Farticles%2Fen%2Fen-the-day-I-jamd.mdx&astroContentModuleFlag=true")],
["src/content/articles/en/en-video-compression.mdx", () => import("astro:content-layer-deferred-module?astro%3Acontent-layer-deferred-module=&fileName=src%2Fcontent%2Farticles%2Fen%2Fen-video-compression.mdx&astroContentModuleFlag=true")]]);

File diff suppressed because one or more lines are too long

3
.gitignore vendored
View File

@ -1,5 +1,6 @@
# build output # build output
dist/ dist/
.astro/
# dependencies # dependencies
node_modules/ node_modules/
@ -18,5 +19,5 @@ pnpm-debug.log*
# macOS-specific files # macOS-specific files
.DS_Store .DS_Store
# i18n # astro
astro_tmp_pages_* astro_tmp_pages_*

View File

@ -5,12 +5,18 @@ import BaseLayout from '../layouts/BaseLayout.astro'
import { getCollection } from 'astro:content' import { getCollection } from 'astro:content'
// get all articles // get all articles
const allArticles = await getCollection('articles', ({ data }) => { const frArticles = await getCollection('articles', ({ data }) => {
return !data.draft return !data.draft && data.lang === 'fr'
})
const enArticles = await getCollection('articles', ({ data }) => {
return !data.draft && data.lang === 'en'
}) })
// get all snippets // get all snippets
const allFragments = await getCollection('fragments', ({ data }) => { const frFragments = await getCollection('fragments', ({ data }) => {
return !data.draft return !data.draft && data.lang === 'fr'
})
const enFragments = await getCollection('fragments', ({ data }) => {
return !data.draft && data.lang === 'en'
}) })
const pageTitle = 'Plan du site' const pageTitle = 'Plan du site'
@ -29,36 +35,63 @@ const pageTitle = 'Plan du site'
<h2> <h2>
<a href='/articles'>Articles</a> <a href='/articles'>Articles</a>
</h2> </h2>
<h3>Articles en français</h3>
<ul> <ul>
{ {
allArticles.map((article) => ( frArticles.map((article) => (
<li> <li>
<a href={`/articles/${article.data.slug}`}> <a href={`/articles/${article.data.slug}`}>
{article.data.title} <sup>({article.data.lang})</sup> {article.data.title}
</a> </a>
</li> </li>
)) ))
} }
</ul> </ul>
<div lang='en'>
<h3>Articles in english</h3>
<ul>
{
enArticles.map((article) => (
<li>
<a href={`/articles/${article.data.slug}`}>
{article.data.title}
</a>
</li>
))
}
</ul>
</div>
</li> </li>
<li> <li>
<h2> <h2>
<a href='/fragments'>Fragments</a> <a href='/fragments'>Fragments</a>
</h2> </h2>
<h3>Fragments en français</h3>
<ul> <ul>
{ {
allFragments.map((fragment) => ( frFragments.map((fragment) => (
<li> <li>
<a <a href={`/fragments/${fragment.data.slug}`}>
href={`/fragments/${fragment.id}`} {fragment.data.title}
lang={fragment.data.lang !== 'fr' ? fragment.data.lang : null}
>
{fragment.data.title} <sup>({fragment.data.lang})</sup>
</a> </a>
</li> </li>
)) ))
} }
</ul> </ul>
<div lang='en'>
<h3>Snippets in english</h3>
<ul>
{
enFragments.map((fragment) => (
<li>
<a href={`/fragments/${fragment.data.slug}`}>
{fragment.data.title}
</a>
</li>
))
}
</ul>
</div>
</li> </li>
<li> <li>
<h2> <h2>