Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions docs/layouts/partials/chevron-svg.html
Original file line number Diff line number Diff line change
@@ -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 "<svg " "<svg aria-hidden=\"true\" focusable=\"false\" ") -}}
2 changes: 1 addition & 1 deletion docs/layouts/partials/head-css.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

{{ $scssMain := "scss/main.scss"}}
{{ if .Site.IsServer }}
{{ if .IsServer }}
{{/* Note the missing postCSS. This makes it snappier to develop in Chrome, but makes it look sub-optimal in other browsers. */}}
{{ $css := resources.Get $scssMain | toCSS (dict "enableSourceMap" true) }}
<link href="{{ $css.RelPermalink }}" rel="stylesheet">
Expand Down
2 changes: 1 addition & 1 deletion docs/layouts/partials/head.html
Original file line number Diff line number Diff line change
Expand Up @@ -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" }}
<script
src="https://code.jquery.com/jquery-3.5.1.min.js"
integrity="sha256-9/aliU8dGd2tb6OSsuzixeV4y/faTqgFtohetphbbj0="
Expand Down
6 changes: 1 addition & 5 deletions docs/layouts/partials/sidebar.html
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,7 @@
aria-controls="section-{{ $pageId }}"
aria-label="{{ if $activeSection }}Collapse{{ else }}Expand{{ end }} {{ $page.LinkTitle }} section">
<span class="gd-docs-menu-page__chevron">
{{ with resources.Get "icons/chevron-menu.svg" }}
{{ $svg := . | minify }}
{{ $svg := replace $svg.Content "<svg " "<svg aria-hidden=\"true\" focusable=\"false\" " }}
{{ $svg | safeHTML }}
{{ end }}
{{ partialCached "chevron-svg.html" . "chevron" | safeHTML }}
</span>
</button>
{{ end }}
Expand Down
23 changes: 23 additions & 0 deletions docs/layouts/partials/structureddata/capital-titles.html
Original file line number Diff line number Diff line change
@@ -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 -}}
Original file line number Diff line number Diff line change
@@ -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" }}
Expand Down
2 changes: 1 addition & 1 deletion scripts/assemble-versions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Loading