diff --git a/docs/README.md b/docs/README.md index 504db0f3a9..565e4c33b2 100644 --- a/docs/README.md +++ b/docs/README.md @@ -33,7 +33,7 @@ support backwards compatible URLs (from pre-netlify days) and to have the `lates version of the docs URLs work [openpolicyagent.org/docs/latest](https://openpolicyagent.org/docs/latest) the site relies on Netlify URL [redirects and rewrites](https://www.netlify.com/docs/redirects/) -which are defined in [website/layouts/index.redirects](./webiste/layouts/index.redirects) +which are defined in [website/layouts/index.redirects](./website/layouts/index.redirects) and are build into a `_redirects` file when the Hugo build happens via `make production-build` or `make preview-build`. @@ -127,7 +127,7 @@ docker run --rm -it --net=host linkchecker/linkchecker $URL Note: You may need to adjust the `URL` (host and/or port) depending on the environment. For OSX and Windows the host might need to be `host.docker.internal` instead of `localhost`. -> This link checker will work on best with Netlify previews! Just point it at the preview URL instead of the local server. +> This link checker will work best with Netlify previews! Just point it at the preview URL instead of the local server. The "pretty url" feature seems to work best when deployed, running locally may result in erroneous links. ## Live Code Blocks diff --git a/docs/website/layouts/_default/baseof.html b/docs/website/layouts/_default/baseof.html index dbeadc8386..33d3c4df66 100644 --- a/docs/website/layouts/_default/baseof.html +++ b/docs/website/layouts/_default/baseof.html @@ -1,5 +1,5 @@ {{ $isDoc := eq .Section "docs" }} -{{ $isHome := .IsHome }} +{{ $isHome := .IsHome }} {{ if $isHome }} {{/* The homepage layouts/index.html template defines its own content. */}} {{ block "main" . }} diff --git a/docs/website/layouts/partials/docs/dashboard-panel.html b/docs/website/layouts/partials/docs/dashboard-panel.html index 84c4755786..4ed0c665f7 100644 --- a/docs/website/layouts/partials/docs/dashboard-panel.html +++ b/docs/website/layouts/partials/docs/dashboard-panel.html @@ -3,6 +3,7 @@ {{ $releases := site.Data.releases }} {{ $latest := index $releases 1 }} {{ $version := index (split .File.Path "/") 1 }} +{{ $page := trim .RelPermalink "/" }} {{ $isLatest := or (eq $version $latest) (eq $version "latest") }}
@@ -52,7 +53,11 @@ {{ if $isLatest }} {{ $verRef = "latest" }} {{ end }} - + {{ $versionedLink := strings.Replace $page $version $verRef }} + {{ if (eq (site.GetPage $versionedLink).Content "") }} + {{ $versionedLink = printf "docs/%s" $verRef }} + {{ end }} + {{ . }} {{ if $isLatest }}