From 045c2e349504e0e1394f4ca497d8899c1e89ca47 Mon Sep 17 00:00:00 2001 From: "C. Lente" <7017340+clente@users.noreply.github.com> Date: Thu, 9 Feb 2023 17:28:32 -0300 Subject: [PATCH] Fetch menus from YAML --- exampleSite/config.toml | 18 ------------------ exampleSite/content.pt/_index.md | 6 ++++++ exampleSite/content.pt/blog/_index.md | 5 +++++ exampleSite/content/_index.md | 6 ++++++ exampleSite/content/blog/_index.md | 5 +++++ layouts/partials/nav.html | 2 +- 6 files changed, 23 insertions(+), 19 deletions(-) create mode 100644 exampleSite/content.pt/blog/_index.md create mode 100644 exampleSite/content/blog/_index.md diff --git a/exampleSite/config.toml b/exampleSite/config.toml index c847a29..1541258 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -30,15 +30,6 @@ DefaultContentLanguage = "en" [languages.en.params] home = '/' madeWith = '[Feito de pedra](/posts/sites-de-pedra)' # You can use markdown here if you want to link somewhere - [languages.en.menu] - [[languages.en.menu.main]] - name = 'Home' - url = '/' - weight = 1 - [[languages.en.menu.main]] - name = 'Blog' - url = '/blog' - weight = 2 [languages.pt] title = "Site Exemplo" languageName = "Português 🇧🇷" @@ -47,15 +38,6 @@ DefaultContentLanguage = "en" [languages.pt.params] home = '/pt' madeWith = '[Feito de pedra](/posts/sites-de-pedra)' # You can use markdown here if you want to link somewhere - [languages.pt.menu] - [[languages.pt.menu.main]] - name = 'Home' - url = '/pt' - weight = 1 - [[languages.pt.menu.main]] - name = 'Blog' - url = '/pt/blog' - weight = 2 [params] # The "description" of your website. This is used in the meta data of your generated html. diff --git a/exampleSite/content.pt/_index.md b/exampleSite/content.pt/_index.md index 2de08ff..669b505 100644 --- a/exampleSite/content.pt/_index.md +++ b/exampleSite/content.pt/_index.md @@ -1,3 +1,9 @@ +--- +title: "Início" +menu: "main" +weight: 1 +--- + # Um par divino There is a website obesity crisis. Bloated websites full of scripts, ads, and trackers are slowing your readers down every time they try to read your well-crafted content. diff --git a/exampleSite/content.pt/blog/_index.md b/exampleSite/content.pt/blog/_index.md new file mode 100644 index 0000000..7588ac1 --- /dev/null +++ b/exampleSite/content.pt/blog/_index.md @@ -0,0 +1,5 @@ +--- +title: "Blog" +menu: "main" +weight: 2 +--- \ No newline at end of file diff --git a/exampleSite/content/_index.md b/exampleSite/content/_index.md index 6866b81..28872b7 100644 --- a/exampleSite/content/_index.md +++ b/exampleSite/content/_index.md @@ -1,3 +1,9 @@ +--- +title: "Home" +menu: "main" +weight: 1 +--- + # A match made in heaven There is a website obesity crisis. Bloated websites full of scripts, ads, and trackers are slowing your readers down every time they try to read your well-crafted content. diff --git a/exampleSite/content/blog/_index.md b/exampleSite/content/blog/_index.md new file mode 100644 index 0000000..7588ac1 --- /dev/null +++ b/exampleSite/content/blog/_index.md @@ -0,0 +1,5 @@ +--- +title: "Blog" +menu: "main" +weight: 2 +--- \ No newline at end of file diff --git a/layouts/partials/nav.html b/layouts/partials/nav.html index 71f1d12..045c9af 100644 --- a/layouts/partials/nav.html +++ b/layouts/partials/nav.html @@ -1,4 +1,4 @@ -{{ range .Site.Menus.main }} +{{ range .Site.Menus.main.ByWeight }} {{ .Name }} {{ end }} Email