diff --git a/docs/layouts/partials/chevron-svg.html b/docs/layouts/partials/chevron-svg.html new file mode 100644 index 000000000..afe7973f9 --- /dev/null +++ b/docs/layouts/partials/chevron-svg.html @@ -0,0 +1,4 @@ +{{/* Cached chevron SVG icon — loaded and minified once per build. */}} +{{- $icon := resources.Get "icons/chevron-menu.svg" -}} +{{- $svg := $icon | minify -}} +{{- return (replace $svg.Content " diff --git a/docs/layouts/partials/head.html b/docs/layouts/partials/head.html index b29d3b9d3..e6fe3a73f 100644 --- a/docs/layouts/partials/head.html +++ b/docs/layouts/partials/head.html @@ -20,7 +20,7 @@ {{- template "_internal/schema.html" . -}} {{- template "_internal/twitter_cards.html" . -}} -{{ partialCached "head-css.html" . "asdf" }} +{{ partialCached "head-css.html" .Site "head-css" }} - {{ with resources.Get "icons/chevron-menu.svg" }} - {{ $svg := . | minify }} - {{ $svg := replace $svg.Content " {{ end }} diff --git a/docs/layouts/partials/structureddata/capital-titles.html b/docs/layouts/partials/structureddata/capital-titles.html new file mode 100644 index 000000000..2bf3224cc --- /dev/null +++ b/docs/layouts/partials/structureddata/capital-titles.html @@ -0,0 +1,23 @@ +{{/* Returns a slice of unique, capitalized page titles from the site. + Called via partialCached — computed once per build, not per page. */}} +{{- $pageTitles := slice -}} +{{- range .Pages -}} + {{- $pageTitles = $pageTitles | append .Title -}} +{{- end -}} + +{{- $uniquePageTitles := slice -}} +{{- range $pageTitles -}} + {{- if not (in $uniquePageTitles .) -}} + {{- $uniquePageTitles = $uniquePageTitles | append . -}} + {{- end -}} +{{- end -}} + +{{- $capitalTitles := slice -}} +{{- range $uniquePageTitles -}} + {{- $firstChar := substr . 0 1 -}} + {{- if eq $firstChar (upper $firstChar) -}} + {{- $capitalTitles = $capitalTitles | append . -}} + {{- end -}} +{{- end -}} + +{{- return $capitalTitles -}} diff --git a/docs/layouts/partials/structureddata/structureddata.looker.html b/docs/layouts/partials/structureddata/structureddata.looker.html index d6b09b0ad..37e4dd9dd 100644 --- a/docs/layouts/partials/structureddata/structureddata.looker.html +++ b/docs/layouts/partials/structureddata/structureddata.looker.html @@ -1,30 +1,7 @@ {{- $pageData := .Page -}} {{- $siteData := .Site -}} -{{- $sectionTitles := slice -}} -{{- range $siteData.Sections -}} -{{- $sectionTitles = $sectionTitles | append .Title -}} -{{- end -}} - -{{- $pageTitles := slice -}} -{{- range $siteData.Pages -}} -{{- $pageTitles = $pageTitles | append .Title -}} -{{- end -}} - -{{- $uniquePageTitles := slice -}} -{{- range $pageTitles -}} -{{- if not (in $uniquePageTitles .) -}} - {{- $uniquePageTitles = $uniquePageTitles | append . -}} -{{- end -}} -{{- end -}} - -{{- $capitalTitles := slice -}} -{{- range $uniquePageTitles -}} -{{- $firstChar := substr . 0 1 -}} -{{- if eq $firstChar (upper $firstChar) -}} - {{- $capitalTitles = $capitalTitles | append . -}} -{{- end -}} -{{- end -}} +{{- $capitalTitles := partialCached "structureddata/capital-titles.html" $siteData "capital-titles" -}} {{ if in $capitalTitles $pageData.Params.title }} {{ if eq $pageData.Params.title "Introduction" }} diff --git a/scripts/assemble-versions.sh b/scripts/assemble-versions.sh index c7a963714..435ad3581 100755 --- a/scripts/assemble-versions.sh +++ b/scripts/assemble-versions.sh @@ -36,7 +36,7 @@ echo "Removing master's latest directory" rm -rf "${content_dir:?}/latest" # 4. Find the highest numbered version and promote it to "latest" -highest_version=$(ls -1 "./$content_dir/" | grep -E '^[0-9]+$' | sort -V | tail -n 1) +highest_version=$(ls -1 "./$content_dir/" | grep -E '^[0-9]+\.[0-9]+$' | sort -V | tail -n 1) if [ -n "$highest_version" ]; then echo "Promoting version $highest_version to /latest"