From 9641f40f6519815ea4eaebce1762e6dc54c7b093 Mon Sep 17 00:00:00 2001 From: Lucien Cartier-Tilet Date: Mon, 8 May 2023 14:44:10 +0200 Subject: [PATCH] feat: fix missing privacy in sidebar This commit not only fixes the missing privacy page in the sidebar when the website is in English or Elefen, but it also simplifies listing all pages available on the website regardless of the language. --- content/.vuepress/config.ts | 2 +- content/.vuepress/themeLocales.ts | 50 ++++++++++++------------------- content/{README.md => index.md} | 0 3 files changed, 20 insertions(+), 32 deletions(-) rename content/{README.md => index.md} (100%) diff --git a/content/.vuepress/config.ts b/content/.vuepress/config.ts index 4d3a3c2..0a51c4c 100644 --- a/content/.vuepress/config.ts +++ b/content/.vuepress/config.ts @@ -2,7 +2,7 @@ import { defineUserConfig, defaultTheme } from 'vuepress'; import { removeHtmlExtensionPlugin } from 'vuepress-plugin-remove-html-extension'; import head from './head'; import locales from './locales'; -import themeLocales from './themeLocales'; +import { themeLocales } from './themeLocales'; export default defineUserConfig({ lang: 'fr-FR', diff --git a/content/.vuepress/themeLocales.ts b/content/.vuepress/themeLocales.ts index 062867b..43a9833 100644 --- a/content/.vuepress/themeLocales.ts +++ b/content/.vuepress/themeLocales.ts @@ -1,18 +1,24 @@ -const themeLocales = { +const pages: string[] = [ + '/index.md', + '/about.md', + '/find-me.md', + '/resume.md', + '/projects.md', + '/conlanging.md', + '/vocal-synthesis.md', + '/privacy.md', +]; + +const localePages = (languagePrefix: string) => { + return pages.map((page: string) => `/${languagePrefix}${page}`); +}; + +export const themeLocales = { '/': { selectLanguageName: 'Français', tip: 'nota bene', warning: 'attention', - sidebar: [ - '/README.md', - '/about.md', - '/find-me.md', - '/resume.md', - '/projects.md', - '/conlanging.md', - '/vocal-synthesis.md', - '/privacy.md', - ], + sidebar: pages, notFound: [ 'C’est bien vide ici', 'Pourquoi sommes-nous ici?', @@ -30,15 +36,7 @@ const themeLocales = { tip: 'avisa', warning: 'averti', danger: 'peril', - sidebar: [ - '/lfn/index.md', - '/lfn/about.md', - '/lfn/find-me.md', - '/lfn/resume.md', - '/lfn/projects.md', - '/lfn/conlanging.md', - '/lfn/vocal-synthesis.md', - ], + sidebar: localePages('lfn'), notFound: [ 'Ce? Se no ave no cosa asi', 'A do vade tu?', @@ -53,16 +51,6 @@ const themeLocales = { }, '/en/': { selectLanguageName: 'English', - sidebar: [ - '/en/index.md', - '/en/about.md', - '/en/find-me.md', - '/en/resume.md', - '/en/projects.md', - '/en/conlanging.md', - '/en/vocal-synthesis.md', - ], + sidebar: localePages('en'), }, }; - -export default themeLocales; diff --git a/content/README.md b/content/index.md similarity index 100% rename from content/README.md rename to content/index.md