{{- define "headTpl" -}} {{- partial "head/preload-css" (dict "href" "https://download.pingcap.com/style/github-markdown.css") -}} {{- partial "head/preload-css" (dict "href" "/css/doc.css") -}} {{$.Scratch.Set "nav_active" "docs"}} {{$.Scratch.Set "data_i18_link" (print "/docs" (cond (isset .Params "cn") "-cn" "") "/") }} {{ $.Scratch.Set "metaTitle" "TiDB Documentation" }} {{$.Scratch.Set "data_i18_cn" (cond (isset .Params "cn") true false) }} {{- end -}} {{- define "main" -}} {{$.Scratch.Set "docs_stable_version" ""}} {{$.Scratch.Set "docs_type" ""}} {{$.Scratch.Set "docs_repo" ""}} {{$.Scratch.Set "title_prefix" ""}} {{$docs_total_versions := slice ""}} {{ if hasPrefix .RelPermalink (print "/search/" (cond (isset .Params "cn") "docs-cn" "docs") "/tidb-data-migration/") }} {{ $.Scratch.Add "docs_type" "tidb_data_migration" }} {{ $.Scratch.Add "docs_stable_version" ($.Scratch.Get "dm_stable_version") }} {{ $.Scratch.Add "docs_repo" "docs-dm"}} {{ $.Scratch.Add "title_prefix" "TiDB Data Migration" }} {{ $docs_total_versions = $docs_total_versions | append ($.Scratch.Get "dm_total_versions") }} {{ else if hasPrefix .RelPermalink (print "/search/" (cond (isset .Params "cn") "docs-cn" "docs") "/tidb-in-kubernetes/") }} {{ $.Scratch.Add "docs_type" "tidb_in_kubernetes"}} {{ $.Scratch.Add "docs_stable_version" ($.Scratch.Get "operator_stable_version") }} {{ $.Scratch.Add "docs_repo" "docs-tidb-operator"}} {{ $.Scratch.Add "title_prefix" "TiDB in Kubernetes" }} {{ $docs_total_versions = $docs_total_versions | append ($.Scratch.Get "operator_total_versions") }} {{ else }} {{ $.Scratch.Add "docs_type" "tidb" }} {{ $.Scratch.Add "docs_stable_version" ($.Scratch.Get "tidb_stable_version") }} {{ $.Scratch.Add "docs_repo" "docs"}} {{ $.Scratch.Add "title_prefix" "TiDB" }} {{ $docs_total_versions = $docs_total_versions | append ($.Scratch.Get "tidb_total_versions") }} {{ end }} {{ $current_version := default "stable" (index (findRE "(v\\d+\\.\\d+|dev|stable)" .RelPermalink) 0) }}