Compare commits

...

7 Commits

Author SHA1 Message Date
Mark Dumay
c14d3868bb Merge pull request #248 from gethinode/develop
Multilingual
2023-05-11 06:47:51 +02:00
Mark Dumay
067c244770 Merge branch 'main' into develop 2023-05-11 06:40:52 +02:00
mark
d76d275ddb Bump release version 2023-05-11 06:38:57 +02:00
mark
1803759b6b Ensure parsed URLs are language aware 2023-05-11 06:32:31 +02:00
mark
2833cfc15a Remove language URL prefix 2023-05-11 06:28:45 +02:00
mark
0a174def75 Remove language URL prefix 2023-05-11 06:28:24 +02:00
mark
7a7d3a93f9 Translate slug of Dutch blog posts 2023-05-11 06:04:27 +02:00
17 changed files with 30 additions and 25 deletions

View File

@@ -8,7 +8,7 @@
[en.params.head] [en.params.head]
tagline = "A Hugo Theme" tagline = "A Hugo Theme"
[en.params.feature] [en.params.feature]
link = "/en/about" link = "about"
caption = "About" caption = "About"
[en.params.footer] [en.params.footer]
license = "Licensed under Creative Commons (<a href='https://creativecommons.org/licenses/by-nc-sa/4.0/' class='link-secondary' target='_blank'>CC BY-NC-SA 4.0</a>)." license = "Licensed under Creative Commons (<a href='https://creativecommons.org/licenses/by-nc-sa/4.0/' class='link-secondary' target='_blank'>CC BY-NC-SA 4.0</a>)."
@@ -23,7 +23,7 @@
[nl.params.head] [nl.params.head]
tagline = "Een Hugo Thema" tagline = "Een Hugo Thema"
[nl.params.feature] [nl.params.feature]
link = "/nl/over-mij" link = "over-mij"
caption = "Over mij" caption = "Over mij"
[nl.params.footer] [nl.params.footer]
license = "Gelicenseerd onder Creative Commons (<a href='https://creativecommons.org/licenses/by-nc-sa/4.0/' class='link-secondary' target='_blank'>CC BY-NC-SA 4.0</a>)." license = "Gelicenseerd onder Creative Commons (<a href='https://creativecommons.org/licenses/by-nc-sa/4.0/' class='link-secondary' target='_blank'>CC BY-NC-SA 4.0</a>)."

View File

@@ -15,13 +15,13 @@
[[main]] [[main]]
name = "Sample project" name = "Sample project"
url = "/en/projects/sample-project/" url = "/projects/sample-project/"
parent = "Projects" parent = "Projects"
weight = 1 weight = 1
[[main]] [[main]]
name = "Another project" name = "Another project"
url = "/en/projects/another-project/" url = "/projects/another-project/"
parent = "Projects" parent = "Projects"
weight = 2 weight = 2
@@ -61,13 +61,13 @@
[[sample]] [[sample]]
name = "Sample project" name = "Sample project"
url = "/en/projects/sample-project/" url = "/projects/sample-project/"
parent = "Projects" parent = "Projects"
weight = 1 weight = 1
[[sample]] [[sample]]
name = "Another project" name = "Another project"
url = "/en/projects/another-project/" url = "/projects/another-project/"
parent = "Projects" parent = "Projects"
weight = 2 weight = 2
# toml-docs-end sample-navigation # toml-docs-end sample-navigation

View File

@@ -15,13 +15,13 @@
[[main]] [[main]]
name = "Voorbeeldproject" name = "Voorbeeldproject"
url = "/nl/projecten/voorbeeldproject/" url = "/projecten/voorbeeldproject/"
parent = "Projecten" parent = "Projecten"
weight = 1 weight = 1
[[main]] [[main]]
name = "Ander project" name = "Ander project"
url = "/nl/projecten/ander-project/" url = "/projecten/ander-project/"
parent = "Projecten" parent = "Projecten"
weight = 2 weight = 2
@@ -61,13 +61,13 @@
[[sample]] [[sample]]
name = "Voorbeeldproject" name = "Voorbeeldproject"
url = "/nl/projecten/voorbeeldproject/" url = "/projecten/voorbeeldproject/"
parent = "Projecten" parent = "Projecten"
weight = 1 weight = 1
[[sample]] [[sample]]
name = "Ander project" name = "Ander project"
url = "/nl/projecten/ander-project/" url = "/projecten/ander-project/"
parent = "Projecten" parent = "Projecten"
weight = 2 weight = 2
# toml-docs-end sample-navigation # toml-docs-end sample-navigation

View File

@@ -1,6 +1,7 @@
--- ---
author: Mark Dumay author: Mark Dumay
title: Bootstrap elementen title: Bootstrap elementen
slug: bootstrap-elementen
date: 2023-02-17 date: 2023-02-17
description: Gebruik shortcodes om eenvoudig Bootstrap elementen toe te voegen. description: Gebruik shortcodes om eenvoudig Bootstrap elementen toe te voegen.
tags: ["bootstrap", "shortcode"] tags: ["bootstrap", "shortcode"]

View File

@@ -1,6 +1,7 @@
--- ---
author: Mark Dumay author: Mark Dumay
title: Eerste artikel title: Eerste artikel
slug: eerste-artikel
date: 2022-10-01 date: 2022-10-01
description: Dit is mijn eerste artikel. description: Dit is mijn eerste artikel.
tags: ["blog"] tags: ["blog"]

View File

@@ -1,6 +1,7 @@
--- ---
author: Mark Dumay author: Mark Dumay
title: Vierde artikel title: Vierde artikel
slug: vierde-artikel
date: 2023-01-01 date: 2023-01-01
description: Dit is mijn vierde artikel. description: Dit is mijn vierde artikel.
tags: ["blog"] tags: ["blog"]

View File

@@ -1,6 +1,7 @@
--- ---
author: Mark Dumay author: Mark Dumay
title: Tweede artikel title: Tweede artikel
slug: tweede-artikel
date: 2022-11-01 date: 2022-11-01
description: Dit is mijn tweede artikel. description: Dit is mijn tweede artikel.
tags: ["blog"] tags: ["blog"]

View File

@@ -1,6 +1,7 @@
--- ---
author: Mark Dumay author: Mark Dumay
title: Derde artikel title: Derde artikel
slug: derde-artikel
date: 2022-12-01 date: 2022-12-01
description: Dit is mijn derde artikel. description: Dit is mijn derde artikel.
tags: ["blog"] tags: ["blog"]

View File

@@ -6,7 +6,7 @@
<p class="display-1 mt-3 fw-bold">404</p> <p class="display-1 mt-3 fw-bold">404</p>
<p class="fs-3">{{ T "pageNotFoundTitle" }}</p> <p class="fs-3">{{ T "pageNotFoundTitle" }}</p>
</span> </span>
<p>{{ T "pageNotFound" }} <a href="{{ "/" | relURL }}">{{ T "pageNotFoundHome" }}</a>.</p> <p>{{ T "pageNotFound" }} <a href="{{ "/" | relLangURL }}">{{ T "pageNotFoundHome" }}</a>.</p>
</div> </div>
</div> </div>
{{ end }} {{ end }}

View File

@@ -17,14 +17,14 @@
<div class="mt-3"> <div class="mt-3">
<div class="d-none-dark"> <div class="d-none-dark">
{{ range (.GetTerms "tags") -}} {{ range (.GetTerms "tags") -}}
<a class="btn btn-light btn-sm" href="{{ (path.Join .Page.RelPermalink) | relURL }}" role="button">{{ .LinkTitle }}</a> <a class="btn btn-light btn-sm" href="{{ (path.Join .Page.RelPermalink) | relLangURL }}" role="button">{{ .LinkTitle }}</a>
&nbsp; &nbsp;
{{ end -}} {{ end -}}
</div> </div>
<div class="d-none-light"> <div class="d-none-light">
{{ range (.GetTerms "tags") -}} {{ range (.GetTerms "tags") -}}
<a class="btn btn-outline-secondary btn-sm" href="{{ (path.Join .Page.RelPermalink) | relURL }}" role="button">{{ .LinkTitle }}</a> <a class="btn btn-outline-secondary btn-sm" href="{{ (path.Join .Page.RelPermalink) | relLangURL }}" role="button">{{ .LinkTitle }}</a>
&nbsp; &nbsp;
{{ end -}} {{ end -}}
</div> </div>

View File

@@ -60,7 +60,7 @@
{{- range $index, $tag := first $maxTags ($page.GetTerms "tags") -}} {{- range $index, $tag := first $maxTags ($page.GetTerms "tags") -}}
{{- if gt $index 0 }}&nbsp;&bull;&nbsp;{{ end -}} {{- if gt $index 0 }}&nbsp;&bull;&nbsp;{{ end -}}
<a href="{{ (path.Join $tag.Page.RelPermalink) | relURL }}" class="{{ $link }} tag-link" aria-label="tag: {{ $tag.LinkTitle }}">{{ $tag.LinkTitle }}</a> <a href="{{ (path.Join $tag.Page.RelPermalink) | relLangURL }}" class="{{ $link }} tag-link" aria-label="tag: {{ $tag.LinkTitle }}">{{ $tag.LinkTitle }}</a>
{{- end -}} {{- end -}}
</small></p> </small></p>
{{- end -}} {{- end -}}

View File

@@ -169,18 +169,18 @@
{{- $menu_item_url := $menu.URL | relLangURL -}} {{- $menu_item_url := $menu.URL | relLangURL -}}
{{- $page_url:= $page.RelPermalink | relLangURL -}} {{- $page_url:= $page.RelPermalink | relLangURL -}}
{{- $active := hasPrefix $page_url $menu_item_url -}} {{- $active := hasPrefix $page_url $menu_item_url -}}
{{- $url := urls.Parse .URL -}} {{- $url := urls.Parse .URL -}}
{{- $baseurl := urls.Parse $.Site.Params.Baseurl -}} {{- $baseurl := urls.Parse $.Site.Params.Baseurl -}}
{{- if .HasChildren -}} {{- if .HasChildren -}}
<li class="nav-item dropdown"> <li class="nav-item dropdown">
<a class="nav-link {{ if $active }}active{{ end }} dropdown-toggle" href="{{ .URL }}" role="button" data-bs-toggle="dropdown" aria-expanded="false"> <a class="nav-link {{ if $active }}active{{ end }} dropdown-toggle" href="{{ .URL | relLangURL }}" role="button" data-bs-toggle="dropdown" aria-expanded="false">
{{ if $active }}<span class="active">{{ .Name }}</span>{{ else }}{{ .Name }}{{ end }} {{ if $active }}<span class="active">{{ .Name }}</span>{{ else }}{{ .Name }}{{ end }}
</a> </a>
<ul class="dropdown-menu dropdown-menu-end"> <ul class="dropdown-menu dropdown-menu-end">
{{- range .Children -}} {{- range .Children -}}
{{- $child_active := eq $page_url .URL -}} {{- $child_active := eq $page_url (.URL | relLangURL) -}}
<li><a class="dropdown-item {{ if $child_active }}active{{ end }}" href="{{ .URL }}">{{ .Name }}</a></li> <li><a class="dropdown-item {{ if $child_active }}active{{ end }}" href="{{ .URL | relLangURL }}">{{ .Name }}</a></li>
{{- end -}} {{- end -}}
</ul> </ul>
</li> </li>

View File

@@ -7,7 +7,7 @@
</div> </div>
<div class="col text-sm-start text-center col-sm-6 col-md-4"> <div class="col text-sm-start text-center col-sm-6 col-md-4">
{{ range .Site.Menus.social -}} {{ range .Site.Menus.social -}}
<a href="{{ .URL | relURL }}" target="_blank" rel="noopener" aria-label="{{ .Name | safeHTML }}" class="text-decoration-none link-secondary d-inline p-2"> <a href="{{ .URL | relLangURL }}" target="_blank" rel="noopener" aria-label="{{ .Name | safeHTML }}" class="text-decoration-none link-secondary d-inline p-2">
{{ .Pre | safeHTML }} {{ .Pre | safeHTML }}
</a> </a>
{{ end -}} {{ end -}}

View File

@@ -30,7 +30,7 @@
{{- end -}} {{- end -}}
{{- if not hugo.IsProduction -}} {{- if not hugo.IsProduction -}}
<link rel="stylesheet" href="{{ $css.Permalink | relURL }}"> <link rel="stylesheet" href="{{ $css.Permalink | relLangURL }}">
{{- else -}} {{- else -}}
{{- $css = $css | fingerprint | resources.PostProcess -}} {{- $css = $css | fingerprint | resources.PostProcess -}}
<link rel="stylesheet" href="{{ $css.Permalink }}" integrity="{{ $css.Data.Integrity }}" crossorigin="anonymous"> <link rel="stylesheet" href="{{ $css.Permalink }}" integrity="{{ $css.Data.Integrity }}" crossorigin="anonymous">

View File

@@ -13,7 +13,7 @@
{{ .Count }} {{ if gt .Count 1 }} {{ T "articles" }} {{ else }} {{ T "article" }} {{ end }} {{ .Count }} {{ if gt .Count 1 }} {{ T "articles" }} {{ else }} {{ T "article" }} {{ end }}
</div> </div>
<div class="col"> <div class="col">
<a href="{{ (path.Join .Page.RelPermalink) | relURL }}">{{ .Name | markdownify }}</a> <a href="{{ (path.Join .Page.RelPermalink) | relLangURL }}">{{ .Name | markdownify }}</a>
</div> </div>
</div> </div>
{{ end }} {{ end }}
@@ -32,7 +32,7 @@
<p class="text-body-secondary mt-5">{{ $year }}</p> <p class="text-body-secondary mt-5">{{ $year }}</p>
{{ $.Scratch.Set "lastYear" $year }} {{ $.Scratch.Set "lastYear" $year }}
{{ end }} {{ end }}
<a href="{{ .Permalink | relURL }}">{{ if .Draft }}{{ T "draft" | upper }}: {{end}}{{ .Title | markdownify }}</a> <a href="{{ (path.Join .Page.RelPermalink) | relLangURL }}">{{ if .Draft }}{{ T "draft" | upper }}: {{end}}{{ .Title | markdownify }}</a>
</div> </div>
</div> </div>
{{ end }} {{ end }}

4
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{ {
"name": "@gethinode/hinode", "name": "@gethinode/hinode",
"version": "0.12.9", "version": "0.12.10",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "@gethinode/hinode", "name": "@gethinode/hinode",
"version": "0.12.9", "version": "0.12.10",
"license": "MIT", "license": "MIT",
"devDependencies": { "devDependencies": {
"@fortawesome/fontawesome-free": "^6.4.0", "@fortawesome/fontawesome-free": "^6.4.0",

View File

@@ -1,6 +1,6 @@
{ {
"name": "@gethinode/hinode", "name": "@gethinode/hinode",
"version": "0.12.9", "version": "0.12.10",
"description": "Hinode is a clean documentation and blog theme for Hugo, an open-source static site generator", "description": "Hinode is a clean documentation and blog theme for Hugo, an open-source static site generator",
"keywords": [ "keywords": [
"hugo", "hugo",