From ede30fa2bc86b44895dbbbe93c41f36146585831 Mon Sep 17 00:00:00 2001 From: yuki Date: Tue, 14 Oct 2025 04:30:04 -0300 Subject: [PATCH] automate and localize navbar --- _data/navbar.toml | 49 ++++++++++++++++++++++++++++++++++++ _includes/default_navbar.njk | 10 +++----- eleventy.config.js | 2 ++ 3 files changed, 54 insertions(+), 7 deletions(-) create mode 100644 _data/navbar.toml diff --git a/_data/navbar.toml b/_data/navbar.toml new file mode 100644 index 0000000..a5bd6ca --- /dev/null +++ b/_data/navbar.toml @@ -0,0 +1,49 @@ +[en] +[en.home] +name = "home" +url = "/en/" + +[en.about] +name = "about" +url = "/en/about/" + +[en.blog] +name = "blog" +url = "/en/blog/" + +[en.reviews] +name = "reviews" +url = "/en/reviews/" + +[en.links] +name = "links" +url = "/en/links/" + +[en.contact] +name = "contact" +url = "/en/contact/" + +[es] +[es.home] +name = "inicio" +url = "/es/" + +[es.about] +name = "acerca de" +url = "/es/acerca-de/" + +[es.blog] +name = "blog" +url = "/es/blog/" + +[es.reviews] +name = "reviews" +url = "/es/reviews/" + +[es.links] +name = "links" +url = "/es/links/" + +[es.contact] +name = "contacto" +url = "/es/contacto/" diff --git a/_includes/default_navbar.njk b/_includes/default_navbar.njk index df431a2..307cd20 100644 --- a/_includes/default_navbar.njk +++ b/_includes/default_navbar.njk @@ -1,14 +1,10 @@ - diff --git a/eleventy.config.js b/eleventy.config.js index 6948ff3..35c4387 100644 --- a/eleventy.config.js +++ b/eleventy.config.js @@ -10,6 +10,8 @@ module.exports = function(eleventyConfig) { eleventyConfig.addPassthroughCopy("js"); eleventyConfig.addPassthroughCopy("LICENSE.txt"); + eleventyConfig.addNunjucksFilter("values", obj => Object.values(obj)); + eleventyConfig.addPlugin(EleventyI18nPlugin, { defaultLanguage: "en" });