Skip to content

Commit d8b0e6a

Browse files
committed
Set metadata for search engines
noindex for deprecated and in-development versions, canonical link from stable version (e.g. 3.12) to stable alias
1 parent 93bc5ac commit d8b0e6a

File tree

1 file changed

+11
-2
lines changed
  • site/themes/arangodb-docs-theme/layouts/partials

1 file changed

+11
-2
lines changed

site/themes/arangodb-docs-theme/layouts/partials/meta.html

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,20 @@
1717
{{- with $versionShort }}
1818
<meta name="docsearch:version" content="{{ . }}">
1919
{{- end }}
20-
{{- if eq .Path "/arangodb/" }}
20+
{{- if (hasPrefix .Path "/arangodb/") }}
21+
{{- if or (.Page.Store.Get "deprecated") (.Page.Store.Get "inDevelopment") }}<meta name="robots" content="noindex">{{ end }}
22+
{{- if and (eq (.Page.Store.Get "alias") "stable") (not (hasPrefix .RelPermalink "/arangodb/stable/")) }}
23+
{{- $splitLink := split .RelPermalink "/" }}
24+
{{- $s := slice "/arangodb" "stable" }}
25+
{{- range $i, $e := $splitLink }}
26+
{{- if gt $i 2 }}{{ $s = $s | append $e }}{{ end }}
27+
{{- end }}
28+
<link rel="canonical" href="{{ delimit $s "/" }}">
29+
{{- end }}
2130
{{- $shortVersions := slice }}
2231
{{- $versions := index site.Data.versions "/arangodb/" }}
2332
{{- range $version := $versions }}
24-
{{- $shortVersions = $shortVersions | append $version.name }}
33+
{{- $shortVersions = $shortVersions | append (cond (eq $version.name $version.alias) $version.name $version.alias) }}
2534
{{- end }}
2635
<meta name="docsearch:version" content="{{ delimit $shortVersions "," }}">
2736
{{- end }}

0 commit comments

Comments
 (0)