summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorache <ache@ache.one>2023-07-05 07:34:37 +0200
committerache <ache@ache.one>2023-07-05 07:34:37 +0200
commitd8f3be76af854acb58ea6ef9521dd90424117461 (patch)
tree0d9a6dec0d610a35f153b9361280dd821f4e4034
parentFix table of contents (diff)
i18n for RSS
-rw-r--r--src/build/i18n.mjs14
-rw-r--r--src/build/index.mjs2
-rw-r--r--src/build/rss.mjs14
-rw-r--r--style.xsl11
4 files changed, 29 insertions, 12 deletions
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é,<br><span class="type_wrap"><span class="type">désormais ingénieur.</span></span>',
- 'about_tags': 'GNU\Linux, C, C++, Python, Math, autohébergement, décentralisation, P2P, commun, ... <br> ',
+ 'about_tags': 'GNU\\Linux, C, C++, Python, Math, autohébergement, décentralisation, P2P, commun, ... <br> ',
},
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: `<b>Ceci est un flux RSS</b> à destination des agrégateurs de contenu.<br/>En tant qu'être humain vous cherchez certainement mon site <a href="https://ache.one">mon site web</a>.`
+ },
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,<br><span class="type_wrap"><span class="type">now engineer.</span></span>',
- 'about_tags': 'GNU\Linux, C, C++, Python, Math, self-hosted, dececntralisation, P2P, ... <br>',
+ 'about_tags': 'GNU\\Linux, C, C++, Python, Math, self-hosted, dececntralisation, P2P, ... <br>',
},
title: {
'main': 'ache: Personnel blog',
@@ -35,6 +41,10 @@ const i18n = {
articles: [
'c-language-quirks.md',
],
+ rss: {
+ title: 'ache: Personal blog',
+ description: `<b>This is a RSS feed</b> for content agreagator.<br/>As an humain you may looking for my website <a href="https://ache.one">mon site web</a>.`
+ },
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',
});
diff --git a/style.xsl b/style.xsl
index d59cd9a..6487c18 100644
--- a/style.xsl
+++ b/style.xsl
@@ -10,8 +10,8 @@ xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<link rel="stylesheet" href="/s/css/style.css" />
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
- </head>
- <xsl:apply-templates select="rss/channel"/>
+ </head>
+ <xsl:apply-templates select="rss/channel"/>
</html>
</xsl:template>
<xsl:template match="channel">
@@ -115,8 +115,9 @@ xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<section class="channel">
<header class="header">
<xsl:apply-templates select="title"/>
- <p><b>Ceci est un flux RSS</b> à destination des agrégateurs de contenu.<br/>
- En tant qu'être humain vous cherchez certain <a href="https://ache.one">mon site web.</a></p>
+ <p>
+ <xsl:value-of select="description" disable-output-escaping="yes"/>
+ </p>
</header>
<xsl:apply-templates select="item"/>
</section>
@@ -126,7 +127,7 @@ xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="title">
<h1 class="title"><xsl:value-of select="text()"/></h1>
</xsl:template>
- <xsl:template match="description">
+ <xsl:template match="quick_description">
<span class="description"><xsl:value-of select="substring-before(text(),'Visit')"/><br /></span>
</xsl:template>
<xsl:template match="category">