From 082b193d23882239d552230e390d34a580821aa4 Mon Sep 17 00:00:00 2001 From: Nico Date: Fri, 3 Feb 2023 10:37:28 +0100 Subject: [PATCH] lot of content --- .astro-i18n/generated.d.ts | 4 +- astro.config.mjs | 17 ++- astro.i18n.config.ts | 1 + package.json | 3 +- pnpm-lock.yaml | 38 ++++++ src/components/LangSwitcher.astro | 15 +- src/components/Navigation.astro | 4 - src/content/articles/en/faq.md | 3 +- src/content/articles/en/gratuiste.md | 3 +- src/content/articles/en/the-day-I-jamd.mdx | 2 +- ...o-compression.md => video-compression.mdx} | 39 +----- .../articles/fr/after-effects-expressions.md | 3 +- src/content/articles/fr/video-compression.md | 3 +- src/content/config.ts | 2 + src/content/fragments/en/buttons.md | 1 + .../en/{image-full.md => image-full.mdx} | 3 +- src/content/fragments/fr/array-vs-array.md | 3 +- .../fragments/fr/{buttons.md => buttons.mdx} | 9 +- .../fr/{image-full.md => image-full.mdx} | 0 src/content/fragments/fr/toulouse-fun.md | 3 +- src/content/types.generated.d.ts | 16 +-- src/data/HP/en/03-about.md | 2 +- src/data/HP/fr/03-about.md | 2 +- src/pages/articles/index.astro | 2 +- src/pages/en/sitemap.astro | 7 + src/pages/fragments/index.astro | 2 +- src/pages/i18n/en.json | 2 +- src/pages/i18n/fr.json | 4 +- src/pages/index.astro | 4 +- src/pages/plan-du-site.astro | 82 +++++++++++ src/styles/editorial/buttons.css | 129 ++++++++++++++++++ 31 files changed, 338 insertions(+), 70 deletions(-) rename src/content/articles/en/{video-compression.md => video-compression.mdx} (90%) rename src/content/fragments/en/{image-full.md => image-full.mdx} (77%) rename src/content/fragments/fr/{buttons.md => buttons.mdx} (97%) rename src/content/fragments/fr/{image-full.md => image-full.mdx} (100%) create mode 100644 src/pages/en/sitemap.astro create mode 100644 src/pages/plan-du-site.astro create mode 100644 src/styles/editorial/buttons.css diff --git a/.astro-i18n/generated.d.ts b/.astro-i18n/generated.d.ts index 24f006f..de79448 100644 --- a/.astro-i18n/generated.d.ts +++ b/.astro-i18n/generated.d.ts @@ -1,8 +1,8 @@ type DefaultLangCode = "fr" type SupportedLangCode = "en" type LangCode = DefaultLangCode | SupportedLangCode -type RouteUri = | "/articles/[slug]" | "/articles" | "/agments/[slug]" | "/agments" | "/tags/[tag]" | "/tags" | "/" -type RouteParams = {"/articles/[slug]": { "slug": string; }; "/articles": undefined; "/agments/[slug]": { "slug": string; }; "/agments": undefined; "/tags/[tag]": { "tag": string; }; "/tags": undefined; "/": undefined; } +type RouteUri = | "/articles/[slug]" | "/articles" | "/agments/[slug]" | "/agments" | "/tags/[tag]" | "/tags" | "/" | "/plan-du-site" +type RouteParams = {"/articles/[slug]": { "slug": string; }; "/articles": undefined; "/agments/[slug]": { "slug": string; }; "/agments": undefined; "/tags/[tag]": { "tag": string; }; "/tags": undefined; "/": undefined; "/plan-du-site": undefined; } type TranslationPath = "accueil" | "tagline" | "copyright" | "contact.title" | "contact.email" | "contact.tel" | "contenuVide" | "header.skipLink" | "header.mainNav" | "header.homeLink" | "sitemap" | "prevNext.contenus" | "prevNext.precedent" | "prevNext.suivant" | "article.titre" | "article.tagline" | "article.published" | "meta.publication" | "meta.modification" | "meta.credit" | "fragments.titre" | "fragments.tagline" | "projet.titre" | "projet.tagline" | "projet.cta" | "projet.lienTitle" | "projet.fenetre" | "erreur.introuvable" | "erreur.autre" | "erreur.lienRetour" | "seo.article.title" | "seo.article.description" | "seo.projet.title" | "seo.projet.description" | "seo.code.title" | "seo.code.description" | "index.articles.pageName" | "index.articles.subtitle" | "index.fragments.pageName" | "index.fragments.subtitle" | "index.title" | "index.subtitle" | "index.quoi" | "index.comment" | "index.opensource" | "index.writing" | "index.latestProjects" | "index.latestArticles" | "index.allProjects" | "index.allArticles" | "index.latestSnippets" | "index.allSnippets" | "index.toc" | "contact.contenuVide" type TranslationOptions = { "accueil": {} | undefined; "tagline": {} | undefined; "copyright": {} | undefined; "contact.title": {} | undefined; "contact.email": {} | undefined; "contact.tel": {} | undefined; "contenuVide": {} | undefined; "header.skipLink": {} | undefined; "header.mainNav": {} | undefined; "header.homeLink": {} | undefined; "sitemap": {} | undefined; "prevNext.contenus": {} | undefined; "prevNext.precedent": {} | undefined; "prevNext.suivant": {} | undefined; "article.titre": {} | undefined; "article.tagline": {} | undefined; "article.published": { datetime: unknown; options: unknown; }; "meta.publication": {} | undefined; "meta.modification": {} | undefined; "meta.credit": {} | undefined; "fragments.titre": {} | undefined; "fragments.tagline": {} | undefined; "projet.titre": {} | undefined; "projet.tagline": {} | undefined; "projet.cta": {} | undefined; "projet.lienTitle": {} | undefined; "projet.fenetre": {} | undefined; "erreur.introuvable": {} | undefined; "erreur.autre": {} | undefined; "erreur.lienRetour": {} | undefined; "seo.article.title": {} | undefined; "seo.article.description": {} | undefined; "seo.projet.title": {} | undefined; "seo.projet.description": {} | undefined; "seo.code.title": {} | undefined; "seo.code.description": {} | undefined; "index.articles.pageName": {} | undefined; "index.articles.subtitle": {} | undefined; "index.fragments.pageName": {} | undefined; "index.fragments.subtitle": {} | undefined; "index.title": {} | undefined; "index.subtitle": {} | undefined; "index.quoi": {} | undefined; "index.comment": {} | undefined; "index.opensource": {} | undefined; "index.writing": {} | undefined; "index.latestProjects": {} | undefined; "index.latestArticles": {} | undefined; "index.allProjects": {} | undefined; "index.allArticles": {} | undefined; "index.latestSnippets": {} | undefined; "index.allSnippets": {} | undefined; "index.toc": {} | undefined; "contact.contenuVide": {} | undefined; } diff --git a/astro.config.mjs b/astro.config.mjs index 622f63c..c242484 100644 --- a/astro.config.mjs +++ b/astro.config.mjs @@ -6,14 +6,29 @@ import i18n from "astro-i18n"; // https://astro.build/config import image from "@astrojs/image"; import mdx from "@astrojs/mdx"; +import sitemap from "@astrojs/sitemap"; // https://astro.build/config export default defineConfig({ + site: "https://www.nardu.in", experimental: { contentCollections: true, }, markdown: { syntaxHighlight: "prism", }, - integrations: [i18n(), image(), mdx()], + integrations: [ + i18n(), + image(), + mdx(), + sitemap({ + i18n: { + defaultLocale: "fr", // All urls that don't contain `en` + locales: { + fr: "fr-FR", // The `defaultLocale` value must present in `locales` keys + en: "en-US", + }, + }, + }), + ], }); diff --git a/astro.i18n.config.ts b/astro.i18n.config.ts index bfea82c..ae8268f 100644 --- a/astro.i18n.config.ts +++ b/astro.i18n.config.ts @@ -12,6 +12,7 @@ export default defineAstroI18nConfig({ en: { "sci-hub-blocage": "sci-hub-unblock", fragments: "snippets", + "plan-du-site": "sitemap", }, }, }); diff --git a/package.json b/package.json index 1ea342e..9096503 100644 --- a/package.json +++ b/package.json @@ -15,6 +15,7 @@ "dependencies": { "@astrojs/image": "^0.12.1", "@astrojs/mdx": "^0.13.0", + "@astrojs/sitemap": "^1.0.0", "astro": "1.7.2", "astro-i18n": "^1.4.5" }, @@ -23,6 +24,6 @@ "postcss": "^8.4.20" }, "engines": { - "node": "16.18.1" + "node": "16.19.0" } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index d081058..cc3b21a 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -3,6 +3,7 @@ lockfileVersion: 5.4 specifiers: '@astrojs/image': ^0.12.1 '@astrojs/mdx': ^0.13.0 + '@astrojs/sitemap': ^1.0.0 astro: 1.7.2 astro-i18n: ^1.4.5 autoprefixer: ^10.4.13 @@ -11,6 +12,7 @@ specifiers: dependencies: '@astrojs/image': 0.12.1 '@astrojs/mdx': 0.13.0 + '@astrojs/sitemap': 1.0.0 astro: 1.7.2 astro-i18n: 1.4.5 @@ -153,6 +155,13 @@ packages: prismjs: 1.29.0 dev: false + /@astrojs/sitemap/1.0.0: + resolution: {integrity: sha512-42GxuF5FP7RaKXZrwGLBLOX3hPv+Wl7ExJC43O0J5e34ojJkLeKf7QfwN1UwrJlqH0Ywi0Fm4/xGe482G09+wg==} + dependencies: + sitemap: 7.1.1 + zod: 3.20.2 + dev: false + /@astrojs/telemetry/1.0.1: resolution: {integrity: sha512-SJVfZHp00f8VZsT1fsx1+6acJGUNt/84xZytV5znPzzNE8RXjlE0rv03llgTsEeUHYZc6uJah91jNojS7RldFg==} engines: {node: ^14.18.0 || >=16.12.0} @@ -677,6 +686,10 @@ packages: '@types/unist': 2.0.6 dev: false + /@types/node/17.0.45: + resolution: {integrity: sha512-w+tIMs3rq2afQdsPJlODhoUEKzFP1ayaoyl1CcnwtIlsVe7K7bA1NGm4s3PraqTLlXnbIN84zuBlxBWo1u9BLw==} + dev: false + /@types/parse5/6.0.3: resolution: {integrity: sha512-SuT16Q1K51EAVPz1K29DJ/sXjhSQ0zjvsypYJ6tlwVsRV9jwW5Adq2ch8Dq8kDBCkYnELS7N7VNCSB5nC56t/g==} dev: false @@ -685,6 +698,12 @@ packages: resolution: {integrity: sha512-60BCwRFOZCQhDncwQdxxeOEEkbc5dIMccYLwbxsS4TUNeVECQ/pBJ0j09mrHOl/JJvpRPGwO9SvE4nR2Nb/a4Q==} dev: false + /@types/sax/1.2.4: + resolution: {integrity: sha512-pSAff4IAxJjfAXUG6tFkO7dsSbTmf8CtUpfhhZ5VhkRpC4628tJhh3+V6H1E+/Gs9piSzYKT5yzHO5M4GG9jkw==} + dependencies: + '@types/node': 17.0.45 + dev: false + /@types/unist/2.0.6: resolution: {integrity: sha512-PBjIUxZHOuj0R15/xuwJYjFi+KZdNFrehocChv4g5hu6aFroHue8m0lBP0POdK2nKzbw0cgV1mws8+V/JAcEkQ==} dev: false @@ -757,6 +776,10 @@ packages: engines: {node: '>=12'} dev: false + /arg/5.0.2: + resolution: {integrity: sha512-PYjyFOLKQ9y57JvQ6QLo8dAgNqswh8M1RMJYdQduT6xbWSgK36P/Z/v+p888pM69jMMfS8Xd8F6I1kQ/I9HUGg==} + dev: false + /argparse/1.0.10: resolution: {integrity: sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==} dependencies: @@ -3166,6 +3189,10 @@ packages: suf-log: 2.5.3 dev: false + /sax/1.2.4: + resolution: {integrity: sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==} + dev: false + /section-matter/1.0.0: resolution: {integrity: sha512-vfD3pmTzGpufjScBh50YHKzEu2lxBWhVEHsNGoEXmCmn2hKGfeNLYMzCJpe8cD7gqX7TJluOVpBkAequ6dgMmA==} engines: {node: '>=4'} @@ -3235,6 +3262,17 @@ packages: resolution: {integrity: sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg==} dev: false + /sitemap/7.1.1: + resolution: {integrity: sha512-mK3aFtjz4VdJN0igpIJrinf3EO8U8mxOPsTBzSsy06UtjZQJ3YY3o3Xa7zSc5nMqcMrRwlChHZ18Kxg0caiPBg==} + engines: {node: '>=12.0.0', npm: '>=5.6.0'} + hasBin: true + dependencies: + '@types/node': 17.0.45 + '@types/sax': 1.2.4 + arg: 5.0.2 + sax: 1.2.4 + dev: false + /slash/4.0.0: resolution: {integrity: sha512-3dOsAHXXUkQTpOYcoAxLIorMTp4gIQr5IW3iVb7A7lFIp0VHhnynm9izx6TssdrIcVIESAlVjtnO2K8bg+Coew==} engines: {node: '>=12'} diff --git a/src/components/LangSwitcher.astro b/src/components/LangSwitcher.astro index f8ea05a..9af34e5 100644 --- a/src/components/LangSwitcher.astro +++ b/src/components/LangSwitcher.astro @@ -7,6 +7,19 @@ const availableLocales = astroI18n.langCodes.filter( ); // current path const currentRoute = Astro.url.pathname; + +function localeName(locale) { + let localeName = ""; + switch (locale) { + case "fr": + localeName = "Français"; + break; + case "en": + localeName = "English"; + break; + } + return localeName; +} ---