From a179ae01caa9af6222f93719d8dc5a966e153665 Mon Sep 17 00:00:00 2001 From: Jonas Rosland Date: Wed, 2 Sep 2020 17:20:46 -0400 Subject: [PATCH] Fix for docs redirects (#2895) * Fixing redirects Signed-off-by: jonasrosland * Fix netlify config Signed-off-by: jonasrosland * Add previous redirects Signed-off-by: jonasrosland * Change netlify publish path Signed-off-by: jonasrosland * Add new redirect for restic Signed-off-by: jonasrosland --- site/config.yaml | 10 +++++++++- site/layouts/_default/baseof.html | 2 +- site/layouts/docs/docs.html | 5 ----- site/layouts/index.redirects | 14 ++++++++++++++ site/layouts/partials/head-docs.html | 2 +- 5 files changed, 25 insertions(+), 8 deletions(-) create mode 100644 site/layouts/index.redirects diff --git a/site/config.yaml b/site/config.yaml index 1875aedde..cddd0f2ad 100644 --- a/site/config.yaml +++ b/site/config.yaml @@ -88,7 +88,7 @@ enableGitInfo: true permalinks: posts: "/blog/:slug/" outputs: - home: ["HTML"] + home: [ "HTML", "REDIRECTS" ] section: ["HTML"] page: ["HTML"] taxonomy: ["HTML"] @@ -104,3 +104,11 @@ markup: noClasses: true style: monokai tabWidth: 4 + +mediaTypes: + "text/netlify": + delimiter: "" +outputFormats: + REDIRECTS: + mediaType: "text/netlify" + baseName: "_redirects" diff --git a/site/layouts/_default/baseof.html b/site/layouts/_default/baseof.html index e74353484..32a40adb0 100644 --- a/site/layouts/_default/baseof.html +++ b/site/layouts/_default/baseof.html @@ -8,7 +8,7 @@ {{ $options := (dict "targetPath" "styles.css" "outputStyle" "compressed" "enableSourceMap" true) }} {{ $styles := resources.Get "styles.scss" | toCSS $options | resources.Fingerprint }} - + {{ block "title" . }}{{ .Site.Title }} {{ .Page.Title }}{{ end }} diff --git a/site/layouts/docs/docs.html b/site/layouts/docs/docs.html index d2ce25040..40bd58d36 100644 --- a/site/layouts/docs/docs.html +++ b/site/layouts/docs/docs.html @@ -14,11 +14,6 @@ {{ .Site.Title }} Docs - {{ .Title }} {{ end }} -{{ if not (isset .CurrentSection.Params "version") }} - {{ $latest_url := replace .Permalink "/docs" (printf "/docs/%s" .Site.Params.latest) | relURL }} - -{{ end }} -
diff --git a/site/layouts/index.redirects b/site/layouts/index.redirects new file mode 100644 index 000000000..402e3bdc8 --- /dev/null +++ b/site/layouts/index.redirects @@ -0,0 +1,14 @@ +{{ $versions := site.Params.versions }} +{{ $latest := site.Params.latest }} +/docs /docs/{{ $latest }} 301! +/docs/latest /docs/{{ $latest }} +/docs/latest/* /docs/{{ $latest }}/:splat +/docs/troubleshooting /docs/{{ $latest }}/troubleshooting +/docs/supported-providers /docs/{{ $latest }}/supported-providers +/docs/zenhub /docs/{{ $latest }}/zenhub +/docs/install-overview /docs/{{ $latest }}/basic-install +/docs/start-contributing /docs/{{ $latest }}/start-contributing +/docs/customize-installation /docs/{{ $latest }}/customize-installation +/docs/faq /docs/{{ $latest }}/faq +/docs/csi /docs/{{ $latest }}/csi +/docs/restic /docs/{{ $latest }}/restic diff --git a/site/layouts/partials/head-docs.html b/site/layouts/partials/head-docs.html index 4eb6e72a7..c92837b2f 100644 --- a/site/layouts/partials/head-docs.html +++ b/site/layouts/partials/head-docs.html @@ -6,6 +6,6 @@ {{ $options := (dict "targetPath" "styles.css" "outputStyle" "compressed" "enableSourceMap" true) }} {{ $styles := resources.Get "styles.scss" | toCSS $options | resources.Fingerprint }} - + {{/* TODO {% seo %}*/}}