Fetch menus from YAML

This commit is contained in:
C. Lente 2023-02-09 17:28:32 -03:00
parent 7a4c8fd24b
commit 045c2e3495
No known key found for this signature in database
GPG Key ID: B0B503C26E05781B
6 changed files with 23 additions and 19 deletions

View File

@ -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.

View File

@ -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.

View File

@ -0,0 +1,5 @@
---
title: "Blog"
menu: "main"
weight: 2
---

View File

@ -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.

View File

@ -0,0 +1,5 @@
---
title: "Blog"
menu: "main"
weight: 2
---

View File

@ -1,4 +1,4 @@
{{ range .Site.Menus.main }}
{{ range .Site.Menus.main.ByWeight }}
<a href="{{ .URL | absLangURL }}">{{ .Name }}</a>
{{ end }}
<a href="mailto:{{ .Site.Params.email }}?subject={{ i18n "email-subject" }}'{{ .Page.Title | default .Site.Title }}'">Email</a>