Compare commits

...

11 Commits

Author SHA1 Message Date
Mark Dumay
4d0007a26b Merge pull request #298 from gethinode/reedirect
Add support for version redirects
2023-06-17 12:33:45 +02:00
Mark Dumay
ac7e564857 Merge branch 'main' into reedirect 2023-06-17 12:27:34 +02:00
mark
f804ab747c Bump package release 2023-06-17 12:26:49 +02:00
mark
cfd292ddff Add support for version redirects 2023-06-17 12:21:11 +02:00
Mark Dumay
d4b0c379e2 Merge pull request #297 from gethinode/versioning
Add support for version overview
2023-06-17 06:27:38 +02:00
Mark Dumay
60ebd5fd41 Merge branch 'main' into versioning 2023-06-17 06:17:52 +02:00
mark
19a4398c90 Add support for optional version overview 2023-06-17 06:14:13 +02:00
mark
841c2e397f Make urls language aware 2023-06-17 06:13:59 +02:00
mark
3f42d781ec Fix overflow for large version menu entries 2023-06-17 06:13:20 +02:00
mark
dd9fcc6cbd Add support for optional version overview 2023-06-17 06:12:32 +02:00
mark
70aed1ed63 Add site title to version switch in collapsed menu 2023-06-17 05:14:22 +02:00
6 changed files with 27 additions and 5 deletions

View File

@@ -91,6 +91,8 @@
translation: "Code"
- id: latest
translation: "latest"
- id: allVersions
translation: "All versions"
# 404 page
- id: pageNotFound

View File

@@ -81,6 +81,8 @@
translation: "Code"
- id: latest
translation: "meest recente"
- id: allVersions
translation: "Alle versies"
# 404 page
- id: pageNotFound

6
layouts/index.redirects Normal file
View File

@@ -0,0 +1,6 @@
{{- $list := site.Params.docs.releases -}}
{{- range $index, $item := $list -}}
{{- if $item.redirect -}}
{{ urls.JoinPath $item.url "/*" }} {{ urls.JoinPath $item.redirect ":splat" }} 200
{{- end -}}
{{- end -}}

View File

@@ -58,14 +58,19 @@
<li class="nav-item dropdown {{ if $collapsed }}d-{{ $size }}-none{{ else }}d-none d-{{ $size }}-block{{ end }}">
<a class="nav-link dropdown-toggle" href="#!" role="button" data-bs-toggle="dropdown" aria-expanded="false" id="navbar-version-switch">
<span class="d-md-none"></span>{{ $version }}
{{ if $collapsed }}{{ site.Title }} {{ end }}{{ $version }}
</a>
<ul class="dropdown-menu dropdown-menu-end" aria-labelledby="navbar-version-switch">
{{- range $index, $item := $list -}}
{{- $active := eq $item.label $version -}}
{{- $disabled := false -}}
{{- if site.IsServer }}
{{- $disabled = and $item.redirect (gt (len $item.redirect) 0) -}}
{{- end -}}
{{ if $item.url }}
<li>
<a class="dropdown-item{{ if $collapsed }} switch-mode-collapsed{{ end }}{{ if $active }} active{{ end }}" href="{{ $item.url }}">{{ $item.label }}
{{- $url := (path.Join $item.url) | relLangURL -}}
<a class="pe-5 dropdown-item{{ if $collapsed }} switch-mode-collapsed{{ end }}{{ if $active }} active{{ end }}{{ if $disabled }} disabled{{ end }}" href="{{ $url }}">{{ $item.label }}
{{ if $item.latest }} ({{ T "latest" }}){{ end }}
{{ if $active }}
<span class="position-absolute end-0 me-3">{{- partial "assets/icon.html" (dict "icon" "fas check") }}</span>
@@ -77,6 +82,13 @@
<li><span class="dropdown-header fs-6">{{ $item.label }}</span></li>
{{ end }}
{{- end -}}
{{- if site.Params.docs.overview -}}
{{ if gt (len $list) 0 }}<li><hr class="dropdown-divider"></li>{{ end }}
<li>
{{- $url := (path.Join site.Params.docs.overview) | relLangURL -}}
<a class="dropdown-item{{ if $collapsed }} switch-mode-collapsed{{ end }}" href="{{ $url }}">{{ T "allVersions" }}</a>
</li>
{{- end -}}
</ul>
</li>
{{- end -}}

4
package-lock.json generated
View File

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

View File

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