Skip to content

Commit

Permalink
Merge pull request #313 from gethinode/develop
Browse files Browse the repository at this point in the history
Finalize versioned docs support
  • Loading branch information
markdumay committed Jun 26, 2023
2 parents fcab852 + 6802524 commit 3db2b1f
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 31 deletions.
6 changes: 1 addition & 5 deletions config/_default/params.toml
Expand Up @@ -8,13 +8,9 @@

# toml-docs-start docs
[docs]
latest = "1.0"
version = "0.8"
basePath = ""
github = "https://github.com/gethinode/hinode"
release = "https://github.com/gethinode/hinode/releases/tag/"
checkVersion = true
latestURL = "https://demo.gethinode.com/"
checkVersion = false
# toml-docs-end docs

# toml-docs-start home
Expand Down
4 changes: 2 additions & 2 deletions content/en/about.md
Expand Up @@ -2,7 +2,7 @@
title: About
description: Hinode is a clean documentation and blog theme for your Hugo site based on Bootstrap 5.
date: 2022-04-11
updated: 2023-02-11
updated: 2023-06-26
showComments: false
---

Expand Down Expand Up @@ -35,8 +35,8 @@ Additional features include:
* Switching between light mode and dark mode
* Support for multiple languages
* Reusable Bootstrap components through configurable shortcodes and partials
* Versioned documentation, including sidebar navigation and version switcher
* Embedded comments through light-weight integration with GitHub via [utteranc.es]({{< param "links.utterances" >}})
* Integrated sidebar navigation for content-heavy sections, such as documentation pages
* Reponsive image handling for multiple screen sizes and resolutions
* Optimized search results, scoring 100 points for SEO on [PageSpeed Insights]({{< param "links.pagespeed" >}})
* Secure by default, scoring A+ on [Mozilla Observatory test]({{< param "links.observatory" >}})
Expand Down
3 changes: 2 additions & 1 deletion content/nl/about.md
Expand Up @@ -3,6 +3,7 @@ slug: over-mij
title: Over mij
description: Een blog en documentatie thema voor Hugo gebaseerd op Bootstrap 5.
date: 2023-02-17
updated: 2023-06-26
showComments: false
---

Expand Down Expand Up @@ -36,8 +37,8 @@ Overige functies:
* Omschakelen tussen donkere en lichte modus
* Ondersteuning voor meerdere talen
* Herbruikbare Bootstrap componenten via shortcodes en partials
* Versiebeheer van documentatiepagina's, inclusief secundaire navigatie en selectie van versies
* Integreren van commentaar via [utteranc.es]({{< param "links.utterances" >}})
* Secundaire navigatie voor bijvoorbeeld documentatie
* Optimalisering van foto's voor meerdere schermafmetingen en resoluties
* Optimale zoekresultaten, met 100 punten voor SEO volgens [PageSpeed Insights]({{< param "links.pagespeed" >}})
* Veilige communicatie, met een score van A+ volgens [Mozilla Observatory]({{< param "links.observatory" >}})
Expand Down
36 changes: 20 additions & 16 deletions layouts/partials/utilities/GetVersion.html
Expand Up @@ -7,28 +7,32 @@
{{- $base := .base -}}
{{- $version := "" -}}

{{- $docsPath := strings.TrimPrefix "/" site.Params.docs.contentPath -}}
{{- if and $page.File (strings.HasPrefix $page.File.Dir $docsPath) -}}
{{- $currentPath := strings.TrimPrefix $docsPath $page.File.Dir -}}
{{- $currentVersion := index (split $currentPath "/") 0 -}}
{{- $versionPath := path.Join site.Params.docs.contentPath $currentVersion -}}
{{- if and site.Params.docs.releases site.Params.docs.contentPath -}}
{{- $docsPath := strings.TrimPrefix "/" site.Params.docs.contentPath -}}
{{- if and $page.File (strings.HasPrefix $page.File.Dir $docsPath) -}}
{{- $currentPath := strings.TrimPrefix $docsPath $page.File.Dir -}}
{{- $currentVersion := index (split $currentPath "/") 0 -}}
{{- $versionPath := path.Join site.Params.docs.contentPath $currentVersion -}}

{{- $list := site.Params.docs.releases -}}
{{- range $index, $item := $list -}}
{{- $url := strings.TrimSuffix "/" $item.url -}}
{{- if eq $url $versionPath -}}
{{- if $base }}{{ $version = path.Base $item.url }}{{ else }}{{ $version = $item.label }}{{ end -}}
{{- $list := site.Params.docs.releases -}}
{{- range $index, $item := $list -}}
{{- $url := strings.TrimSuffix "/" $item.url -}}
{{- if eq $url $versionPath -}}
{{- if $base }}{{ $version = path.Base $item.url }}{{ else }}{{ $version = $item.label }}{{ end -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- end -}}

{{- if not $version -}}
{{- $list := site.Params.docs.releases -}}
{{- range $item := $list -}}
{{- if $item.latest -}}
{{- if $base }}{{ $version = path.Base $item.url }}{{ else }}{{ $version = $item.label }}{{ end -}}
{{- if not $version -}}
{{- $list := site.Params.docs.releases -}}
{{- range $item := $list -}}
{{- if $item.latest -}}
{{- if $base }}{{ $version = path.Base $item.url }}{{ else }}{{ $version = $item.label }}{{ end -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- else -}}
{{- $version = site.Params.docs.version -}}
{{- end -}}

{{- return $version -}}
8 changes: 4 additions & 4 deletions netlify.toml
Expand Up @@ -26,18 +26,18 @@
default-src 'self'; \
child-src 'self' app.netlify.com; \
script-src 'self' \
app.netlify.com netlify-cdp-loader.netlify.app \
https://*.netlify.app app.netlify.com netlify-cdp-loader.netlify.app \
https://utteranc.es/client.js https://*.google-analytics.com https://*.googletagmanager.com; \
style-src 'self' \
netlify.app https://utteranc.es https://fonts.googleapis.com https://www.youtube.com; \
https://*.netlify.app https://utteranc.es https://fonts.googleapis.com https://www.youtube.com; \
object-src 'none'; \
base-uri 'self'; \
connect-src 'self'
https://*.google-analytics.com https://*.analytics.google.com https://*.googletagmanager.com; \
font-src 'self' https://fonts.gstatic.com; \
font-src 'self' https://*.netlify.app https://fonts.gstatic.com; \
frame-src 'self' https://utteranc.es https://www.youtube-nocookie.com https://www.youtube.com \
app.netlify.com; \
img-src 'self' https://i.vimeocdn.com https://i.ytimg.com https://*.google-analytics.com https://*.googletagmanager.com; \
img-src 'self' https://*.netlify.app https://i.vimeocdn.com https://i.ytimg.com https://*.google-analytics.com https://*.googletagmanager.com; \
manifest-src 'self'; \
media-src 'self' \
"""
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "@gethinode/hinode",
"version": "0.15.0-beta5",
"version": "0.15.0",
"description": "Hinode is a clean documentation and blog theme for Hugo, an open-source static site generator",
"keywords": [
"hugo",
Expand Down

0 comments on commit 3db2b1f

Please sign in to comment.