mirror of https://github.com/docker/docs.git
hugo: improve build performance
use cached partials for repeat templates and icons Signed-off-by: David Karlsson <35727626+dvdksn@users.noreply.github.com>
This commit is contained in:
parent
d29dbaf482
commit
df0455d16f
|
@ -54,12 +54,14 @@ the Azure resources.
|
|||
{{< accordion title="JSON template" >}}
|
||||
|
||||
{{< acr-template.inline >}}
|
||||
{{ $data := data.GetJSON "https://prod-scout-integration-templates.s3.amazonaws.com/latest/acr_token_template.json" }}
|
||||
{{ with resources.GetRemote "https://prod-scout-integration-templates.s3.amazonaws.com/latest/acr_token_template.json" }}
|
||||
{{ $data := .Content | transform.Unmarshal }}
|
||||
|
||||
```json
|
||||
{{ transform.Remarshal "json" $data }}
|
||||
```
|
||||
|
||||
{{ end }}
|
||||
{{< /acr-template.inline >}}
|
||||
|
||||
{{< /accordion >}}
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
copying = true;
|
||||
setTimeout(() => copying = false, 2000);"
|
||||
>
|
||||
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg">{{ partial "icon" "content_copy" }}</span>
|
||||
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg">{{ partial "icon" "check_circle" }}</span>
|
||||
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg">{{ partialCached "icon" "content_copy" "content_copy" }}</span>
|
||||
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg">{{ partialCached "icon" "check_circle" "check_circle" }}</span>
|
||||
</button>
|
||||
{{ $result := transform.HighlightCodeBlock . }}
|
||||
<div class="syntax-light dark:syntax-dark">
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
<button
|
||||
class="text-white fixed z-30 top-6 right-8 icon-svg"
|
||||
>
|
||||
{{ partial "icon" "close" }}
|
||||
{{ partialCached "icon" "close" "close" }}
|
||||
</button>
|
||||
<img
|
||||
loading="lazy"
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
rel="noopener">
|
||||
{{- .Text | safeHTML -}}
|
||||
<span class="pl-1 icon-svg icon-sm">
|
||||
{{- partial "icon" "open_in_new" -}}
|
||||
{{- partialCached "icon" "open_in_new" "open_in_new" -}}
|
||||
</span></a>
|
||||
{{- else if (strings.HasPrefix $url "/") -}}
|
||||
{{/* absolute link, use url as-is */}}
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
<tr>
|
||||
<th class="text-left w-32 flex items-center gap-2">
|
||||
<span>Aliases</span>
|
||||
{{ partial "tooltip.html" "An alias is a short or memorable alternative for a longer command." }}
|
||||
{{ partialCached "tooltip.html" "An alias is a short or memorable alternative for a longer command." "cli-alias" }}
|
||||
</th>
|
||||
<td>
|
||||
<div class="flex gap-3">
|
||||
|
@ -71,19 +71,19 @@
|
|||
{{ end }}
|
||||
{{ with $data.kubernetes }}
|
||||
<p>
|
||||
{{ partial "components/badge.html" (dict "color" "blue" "content" "Kubernetes") }}
|
||||
{{ partialCached "components/badge.html" (dict "color" "blue" "content" "Kubernetes") "k8s" }}
|
||||
This command works with the Kubernetes orchestrator.
|
||||
</p>
|
||||
{{ end }}
|
||||
{{ with $data.swarm }}
|
||||
<p>
|
||||
{{ partial "components/badge.html" (dict "color" "blue" "content" "Swarm") }}
|
||||
{{ partialCached "components/badge.html" (dict "color" "blue" "content" "Swarm") "swarm" }}
|
||||
This command works with the Swarm orchestrator.
|
||||
</p>
|
||||
{{ end }}
|
||||
{{ with $data.long }}
|
||||
{{ $heading := dict "level" 2 "text" "Description" }}
|
||||
{{ partial "heading.html" $heading }}
|
||||
{{ partialCached "heading.html" $heading "cli-description" }}
|
||||
{{ $subHeadings := (strings.FindRE `(?m:#{3,4} .*)` .) }}
|
||||
{{ $.Scratch.Add "headings" $heading }}
|
||||
{{ range $subHeadings }}
|
||||
|
@ -97,7 +97,7 @@
|
|||
{{ $opts := where . "hidden" false }}
|
||||
{{ with $opts }}
|
||||
{{ $heading := dict "level" 2 "text" "Options" }}
|
||||
{{ partial "heading.html" $heading }}
|
||||
{{ partialCached "heading.html" $heading "cli-options" }}
|
||||
{{ $.Scratch.Add "headings" $heading }}
|
||||
<table>
|
||||
<thead>
|
||||
|
@ -129,22 +129,22 @@
|
|||
</td>
|
||||
<td>
|
||||
{{ with .min_api_version }}
|
||||
{{ partial "components/badge.html" (dict "color" "blue" "content" (printf "API %s+" .)) }}
|
||||
{{ partialCached "components/badge.html" (dict "color" "blue" "content" (printf "API %s+" .)) "api" . }}
|
||||
{{ end }}
|
||||
{{ with .deprecated }}
|
||||
{{ partial "components/badge.html" (dict "color" "red" "content" "Deprecated") }}
|
||||
{{ partialCached "components/badge.html" (dict "color" "red" "content" "Deprecated") "deprecated" }}
|
||||
{{ end }}
|
||||
{{ with .experimental }}
|
||||
{{ partial "components/badge.html" (dict "color" "amber" "content" "experimental (daemon)") }}
|
||||
{{ partialCached "components/badge.html" (dict "color" "amber" "content" "experimental (daemon)") "exp" }}
|
||||
{{ end }}
|
||||
{{ with .experimentalcli }}
|
||||
{{ partial "components/badge.html" (dict "color" "amber" "content" "experimental (CLI)") }}
|
||||
{{ partialCached "components/badge.html" (dict "color" "amber" "content" "experimental (CLI)") "exp-cli" }}
|
||||
{{ end }}
|
||||
{{ with .kubernetes }}
|
||||
{{ partial "components/badge.html" (dict "color" "blue" "content" "Kubernetes") }}
|
||||
{{ partialCached "components/badge.html" (dict "color" "blue" "content" "Kubernetes") "k8s" }}
|
||||
{{ end }}
|
||||
{{ with .swarm }}
|
||||
{{ partial "components/badge.html" (dict "color" "blue" "content" "Swarm") }}
|
||||
{{ partialCached "components/badge.html" (dict "color" "blue" "content" "Swarm") "swarm" }}
|
||||
{{ end }}
|
||||
{{ if .description }}
|
||||
{{/* replace newlines in long desc with break tags */}}
|
||||
|
@ -159,7 +159,7 @@
|
|||
{{ end }}
|
||||
{{ with $data.examples }}
|
||||
{{ $heading := dict "level" 2 "text" "Examples" }}
|
||||
{{ partial "heading.html" $heading }}
|
||||
{{ partialCached "heading.html" $heading "cli-examples" }}
|
||||
{{ $subHeadings := (strings.FindRE `(?m:#{3,4} .*)` .) }}
|
||||
{{ $.Scratch.Add "headings" $heading }}
|
||||
{{ range $subHeadings }}
|
||||
|
@ -171,7 +171,7 @@
|
|||
{{ end }}
|
||||
{{ if eq .Kind "section" }}
|
||||
{{ $heading := dict "level" 2 "text" "Subcommands" }}
|
||||
{{ partial "heading.html" $heading }}
|
||||
{{ partialCached "heading.html" $heading "cli-subcommands" }}
|
||||
{{ $.Scratch.Add "headings" $heading }}
|
||||
<table>
|
||||
<thead>
|
||||
|
|
|
@ -281,7 +281,7 @@
|
|||
</div>
|
||||
</div>
|
||||
</main>
|
||||
<footer>{{ partial "footer.html" . }}</footer>
|
||||
<footer>{{ partialCached "footer.html" . }}</footer>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<div x-data="{ open: false }" class="border border-gray-light-200 dark:border-gray-dark-200 bg-white dark:bg-gray-dark-100">
|
||||
<button class="not-prose w-full py-2 px-4 flex justify-between" x-on:click="open = ! open">
|
||||
<span>{{ .title }}</span>
|
||||
<span :class="{ 'hidden' : !open }" class="icon-svg">{{ partial "icon" "expand_less" }}</span>
|
||||
<span :class="{ 'hidden' : open }" class="icon-svg">{{ partial "icon" "expand_more" }}</span>
|
||||
<span :class="{ 'hidden' : !open }" class="icon-svg">{{ partialCached "icon" "expand_less" "expand_less" }}</span>
|
||||
<span :class="{ 'hidden' : open }" class="icon-svg">{{ partialCached "icon" "expand_more" "expand_more" }}</span>
|
||||
</button>
|
||||
|
||||
<div x-show="open" x-collapse class="px-4">
|
||||
|
|
|
@ -2,21 +2,21 @@
|
|||
{{ with .File }}
|
||||
{{ if not (in .Filename "/_vendor/") }}
|
||||
<p class="flex items-center gap-2">
|
||||
<span class="icon-svg">{{ partial "icon" "edit" }}</span>
|
||||
<span class="icon-svg">{{ partialCached "icon" "edit" "edit" }}</span>
|
||||
<a class="link" target="_blank" rel="noopener"
|
||||
href="{{ site.Params.repo }}/edit/main/content/{{ .Path }}">{{- T "editPage" -}}
|
||||
<span class="icon-svg icon-xs">
|
||||
{{ partial "icon" "open_in_new" }}
|
||||
{{ partialCached "icon" "open_in_new" "open_in_new" }}
|
||||
</span></a>
|
||||
</p>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
<p class="flex items-center gap-2">
|
||||
<span class="icon-svg">{{ partial "icon" "done" }}</span>
|
||||
<span class="icon-svg">{{ partialCached "icon" "done" "done" }}</span>
|
||||
<a class="link" target="_blank" rel="noopener"
|
||||
href="{{ site.Params.repo }}/issues/new?template=doc_issue.yml&location={{ .Permalink }}&labels=status%2Ftriage">{{- T "requestChanges" -}}
|
||||
<span class="icon-svg icon-xs">
|
||||
{{ partial "icon" "open_in_new" }}
|
||||
{{ partialCached "icon" "open_in_new" "open_in_new" }}
|
||||
</span></a>
|
||||
</a>
|
||||
</p>
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
{{ end }}
|
||||
{{/* preload Roboto Flex as it's a critical font: https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/rel/preload */}}
|
||||
<link href="/assets/fonts/RobotoFlex.woff2" rel="preload" as="font" type="font/woff2" crossorigin />
|
||||
{{ partial "utils/css.html" . }}
|
||||
{{ partialCached "utils/css.html" "-" }}
|
||||
{{ $theme := resources.Get "js/theme.js" | js.Build (dict "minify" true) }}
|
||||
<script>{{ $theme.Content | safeJS }}</script>
|
||||
{{ $js := resources.Match "js/src/**.js"
|
||||
|
@ -55,4 +55,4 @@
|
|||
}}
|
||||
<script defer src="{{ $js.Permalink }}"></script>
|
||||
<link rel="preconnect" href="https://{{ site.Params.algolia.appid }}-dsn.algolia.net" crossorigin />
|
||||
{{ partialCached "utils/resources.html" . }}
|
||||
{{ partialCached "utils/resources.html" "-" }}
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
sidebar.classList.replace('md:block', 'md:hidden');
|
||||
}
|
||||
}" class="icon-svg hidden px-4 md:block" aria-label="Menu">
|
||||
{{ partial "icon" "menu" }}
|
||||
{{ partialCached "icon" "menu" "menu" }}
|
||||
</button>
|
||||
{{ end }}
|
||||
<div>
|
||||
|
@ -31,8 +31,8 @@
|
|||
localStorage.setItem('theme-preference', value);
|
||||
document.firstElementChild.className = value;
|
||||
})" @click="theme = (theme === 'dark' ? 'light' : 'dark')">
|
||||
<span class="icon-svg dark:hidden">{{ partial "icon" "light_mode"}}</span>
|
||||
<span class="icon-svg hidden dark:block">{{ partial "icon" "dark_mode"}}</span>
|
||||
<span class="icon-svg dark:hidden">{{ partialCached "icon" "light_mode" "light_mode"}}</span>
|
||||
<span class="icon-svg hidden dark:block">{{ partialCached "icon" "dark_mode" "dark_mode"}}</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -49,10 +49,10 @@
|
|||
{{ markdownify .entry.sectiontitle }}
|
||||
</span>
|
||||
<span class="icon-svg {{ if $expanded }}hidden{{ end }}">
|
||||
{{ partial "icon" "expand_more" }}
|
||||
{{ partialCached "icon" "expand_more" "expand_more" }}
|
||||
</span>
|
||||
<span class="icon-svg {{ if not $expanded }}hidden{{ end }}">
|
||||
{{ partial "icon" "expand_less" }}
|
||||
{{ partialCached "icon" "expand_less" "expand_less" }}
|
||||
</span>
|
||||
</button>
|
||||
<ul class="{{if not $expanded}}hidden {{end}}ml-3 md:ml-[21px]">
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<div data-tooltip-wrapper>
|
||||
<div data-tooltip-button class="icon-svg flex items-center text-blue-light dark:text-blue-dark">
|
||||
{{ partial "icon" "help" }}
|
||||
{{ partialCached "icon" "help" "help" }}
|
||||
</div>
|
||||
<div data-tooltip-body
|
||||
class="absolute left-0 top-0 hidden max-w-56 rounded bg-accent-light p-2 text-white dark:bg-accent-dark"
|
||||
|
|
Loading…
Reference in New Issue