From d8f3be76af854acb58ea6ef9521dd90424117461 Mon Sep 17 00:00:00 2001 From: ache Date: Wed, 5 Jul 2023 07:34:37 +0200 Subject: i18n for RSS --- src/build/i18n.mjs | 14 ++++++++++++-- src/build/index.mjs | 2 +- src/build/rss.mjs | 14 ++++++++++---- 3 files changed, 23 insertions(+), 7 deletions(-) (limited to 'src/build') diff --git a/src/build/i18n.mjs b/src/build/i18n.mjs index 7ecb2e1..25a6318 100644 --- a/src/build/i18n.mjs +++ b/src/build/i18n.mjs @@ -4,7 +4,7 @@ const i18n = { intro: { 'description': 'Éternel étudiant en Math-Info.', 'about': 'Autodidacte passionné,
désormais ingénieur.', - 'about_tags': 'GNU\Linux, C, C++, Python, Math, autohébergement, décentralisation, P2P, commun, ...
', + 'about_tags': 'GNU\\Linux, C, C++, Python, Math, autohébergement, décentralisation, P2P, commun, ...
', }, title: { 'main': 'ache: Blog personnel', @@ -18,13 +18,19 @@ const i18n = { '2FA-discord-sur-pc.md', 'duckduckgo-google-en-mieux.md', ], + rss: { + title: 'ache: Blog personnel', + 'quick_description': 'Programmation, Algorithmique, Système, *pick you poison*', + description: `Ceci est un flux RSS à destination des agrégateurs de contenu.
En tant qu'être humain vous cherchez certainement mon site mon site web.` + }, toc_keyword: "Sommaire" }, en: { intro: { 'description': 'Eternal student in computer science.', + 'quick_description': 'Programmation, Algorithmique, Système, *pick you poison*', 'about': 'Passionated self-taught person,
now engineer.', - 'about_tags': 'GNU\Linux, C, C++, Python, Math, self-hosted, dececntralisation, P2P, ...
', + 'about_tags': 'GNU\\Linux, C, C++, Python, Math, self-hosted, dececntralisation, P2P, ...
', }, title: { 'main': 'ache: Personnel blog', @@ -35,6 +41,10 @@ const i18n = { articles: [ 'c-language-quirks.md', ], + rss: { + title: 'ache: Personal blog', + description: `This is a RSS feed for content agreagator.
As an humain you may looking for my website mon site web.` + }, toc_keyword: "Table of contents" } } diff --git a/src/build/index.mjs b/src/build/index.mjs index 852eb8d..ad126a8 100644 --- a/src/build/index.mjs +++ b/src/build/index.mjs @@ -88,7 +88,7 @@ for (const lang in i18n) { } console.log(`Create RSS Flux: ${lang}/rss.xml`); - const xmlFeed = getRSS(articles, baseUrl); + const xmlFeed = getRSS(articles, baseUrl, lang); fs.writeFileSync(`${lang}/rss.xml`, xmlFeed); { diff --git a/src/build/rss.mjs b/src/build/rss.mjs index 04b0393..4eec634 100644 --- a/src/build/rss.mjs +++ b/src/build/rss.mjs @@ -1,17 +1,23 @@ import RSS from 'rss'; +import i18n from './i18n.mjs'; -const getRSS = (articles, baseUrl) => { +const getRSS = (articles, baseUrl, lang) => { + console.log(i18n[lang]['rss']['title']); const rssFeed = new RSS({ - title: 'ache: Blog personnel', - description: 'Programmation, Algorithmique, Système, *pick you poison*', + title: i18n[lang]['rss']['title'], + description: i18n[lang]['rss']['description'], // eslint-disable-next-line camelcase + custom_namespaces: { + 'visible_description': i18n[lang]['rss']['description'] + }, + site_url: "https://ache.one", feed_url: `${baseUrl}rss.xml`, canonical: `${baseUrl}rss.xml`, // eslint-disable-next-line camelcase site_url: baseUrl, // eslint-disable-next-line camelcase image_url: `${baseUrl}ache.svg`, - language: 'fr', + language: lang, pubDate: (new Date().toLocaleString()), ttl: '1440', }); -- cgit v1.2.3-70-g09d2