updated canonical tag and added page title header partial

pull/1387/head
Scott Anderson 2020-08-13 11:10:58 -06:00
parent e2620fa9e9
commit e2bff1f90a
3 changed files with 29 additions and 10 deletions

View File

@ -8,15 +8,9 @@
{{ partial "header/google-analytics-head.html" }}
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
{{ if eq $product nil }}
<title>InfluxData Documentation</title>
{{ else if eq $currentVersion nil}}
<title>{{ (index .Site.Data.products $product).name }} Documentation</title>
{{ else if eq (len $productPathData) 2 }}
<title>{{ (index .Site.Data.products $product).name }} {{ $currentVersion }} Documentation</title>
{{ else }}
<title>{{ if .Params.seotitle }} {{ print .Params.seotitle " | " }} {{ else if .Title }} {{ print .Title " | " }} {{ end }}{{ (index .Site.Data.products $product).name }} {{ if $currentVersion }}{{print $currentVersion " " }}{{ end }}Documentation</title>
{{ end }}
{{ partial "header/title" . }}
<meta name="description" content="{{ if .Description }}{{ .Description | markdownify | plainify }}{{else}}{{ .Summary | markdownify | plainify }}{{ end }}">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<link rel="shortcut icon" href="/img/favicon.png" type="image/png" sizes="32x32">

View File

@ -17,7 +17,7 @@
{{ $baseURL := replaceRE `\/$` "" .Site.BaseURL }}
{{ $scratch.Set "canonicalURL" (print $baseURL .RelPermalink) }}
{{ if gt (len (findRE "[^/]+.*?" .RelPermalink)) 2 }}
{{ if ge (len (findRE "[^/]+.*?" .RelPermalink)) 2 }}
{{ $scratch.Set "canonicalURL" (print $baseURL (replaceRE `v[0-9]\.[0-9]{1,2}` $latestMinorVersion .RelPermalink))}}
{{ end }}

View File

@ -0,0 +1,25 @@
{{ $scratch := newScratch }}
{{ $productPathData := findRE "[^/]+.*?" .RelPermalink }}
{{ $product := index $productPathData 0 }}
{{ $currentVersion := index $productPathData 1 }}
{{ $scratch.Set "siteTitle" "InfluxData Documentation" }}
{{ if eq $product nil }}
{{ $scratch.Set "siteTitle" "InfluxData Documentation" }}
{{ else if eq $product "platform"}}
{{ $scratch.Set "siteTitle" "InfluxData Platform Documentation" }}
{{ else if eq $currentVersion nil}}
{{ $scratch.Set "siteTitle" (print (index .Site.Data.products $product).name " Documentation") }}
{{ else }}
{{ $scratch.Set "siteTitle" (print (index .Site.Data.products $product).name " " $currentVersion " Documentation") }}
{{ end }}
{{ $scratch.Set "pageTitle" "" }}
{{ if or (eq $product "platform") (gt (len $productPathData) 2) }}
{{ $scratch.Set "pageTitle" (cond (ne .Params.seotitle nil) .Params.seotitle .Title) }}
{{ end }}
{{ $pageTitle := $scratch.Get "pageTitle" }}
{{ $siteTitle := $scratch.Get "siteTitle" }}
<title>{{ $pageTitle }}{{ cond (ne (len $pageTitle) 0) " | " "" }}{{ $siteTitle }}</title>