mirror of
https://github.com/docker/docs.git
synced 2026-06-19 07:35:16 +00:00
site: simplify guides/series layouts
Signed-off-by: David Karlsson <35727626+dvdksn@users.noreply.github.com>
This commit is contained in:
@@ -5,11 +5,4 @@
|
||||
<div id="TableOfContents" class="overflow-x-auto">
|
||||
{{ partialCached "pagemeta.html" . . }}
|
||||
</div>
|
||||
{{- if ne .Type "guides" }}
|
||||
{{ with .GetTerms "tags" }}
|
||||
<div class="not-prose mt-8 px-4 overflow-x-auto">
|
||||
{{- partial "tags.html" . }}
|
||||
</div>
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
</aside>
|
||||
</aside>
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
<div class="not-prose">
|
||||
<div
|
||||
class="mt-1.5 mb-1.5 flex flex-col gap-4 rounded-sm bg-gray-100 p-6 sm:flex-row dark:bg-gray-800"
|
||||
>
|
||||
<div class="flex flex-grow flex-col sm:items-center">
|
||||
<span><strong>Skill level</strong></span>
|
||||
<span>{{ .Params.skill }}</span>
|
||||
</div>
|
||||
<div class="flex flex-grow flex-col sm:items-center">
|
||||
<span><strong>Time to complete</strong></span>
|
||||
<span>{{ .Params.time }}</span>
|
||||
</div>
|
||||
<div class="flex flex-grow flex-col sm:items-center">
|
||||
<span><strong>Prerequisites</strong></span>
|
||||
<span>{{ .Params.prereq }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -12,6 +12,17 @@
|
||||
<hr />
|
||||
</div>
|
||||
{{ .Content }}
|
||||
{{- if and (eq .Type "guides") (not .IsSection) (ne .CurrentSection .FirstSection) -}}
|
||||
{{- with .PrevInSection -}}
|
||||
<div class="not-prose col-start-2 my-4">
|
||||
<a
|
||||
href="{{ .Permalink }}"
|
||||
class="cursor-pointer rounded-sm bg-blue-500 px-4 py-2 text-white hover:bg-blue-400 dark:bg-blue-800 dark:hover:bg-blue-700"
|
||||
>{{ .Title }} »</a
|
||||
>
|
||||
</div>
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
</article>
|
||||
<div class="-mt-8 hidden min-w-48 flex-1 lg:block">
|
||||
{{ partial "aside.html" . }}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
{{- range . -}}
|
||||
{{- $lang := index site.Data.languages . -}}
|
||||
{{- with $lang }}
|
||||
<span class="chip">
|
||||
<img
|
||||
class="py-1"
|
||||
height="18"
|
||||
width="18"
|
||||
title="{{ .title }}"
|
||||
src="{{ .icon }}"
|
||||
/>
|
||||
<span>{{ .title }}</span>
|
||||
</span>
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
@@ -0,0 +1,9 @@
|
||||
{{- range . -}}
|
||||
{{- $tag := index site.Data.tags . -}}
|
||||
{{- with $tag }}
|
||||
<span class="chip">
|
||||
<span class="icon-svg icon-sm pb-0.5">{{ partialCached "icon" "tag" "tag" }}</span>
|
||||
{{ .title }}
|
||||
</span>
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
@@ -1,23 +0,0 @@
|
||||
{{- /*
|
||||
List of languages (taxonomy) chips with images
|
||||
Context: page.Pages
|
||||
*/
|
||||
-}}
|
||||
{{- range . -}}
|
||||
{{- if eq .File nil }}
|
||||
{{- errorf "[languages] Undefined language: '%s' in %s" (urlize (strings.ToLower .Title)) page.File.Filename }}
|
||||
{{- end }}
|
||||
{{- if not .Page.Params.icon }}
|
||||
{{- errorf "[languages] language is missing an icon: '%s' in %s" (urlize (strings.ToLower .Title)) page.File.Filename }}
|
||||
{{- end }}
|
||||
<span class="chip">
|
||||
<img
|
||||
class="py-1"
|
||||
height="18"
|
||||
width="18"
|
||||
title="{{ .Page.LinkTitle }}"
|
||||
src="{{ .Page.Params.icon }}"
|
||||
/>
|
||||
<span>{{ .Page.LinkTitle }}</span>
|
||||
</span>
|
||||
{{- end -}}
|
||||
@@ -43,6 +43,16 @@
|
||||
{{- $schema = merge $schema (dict "keywords" .) -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- /* Add proficiency level if specified in frontmatter */ -}}
|
||||
{{- with .Params.proficiencyLevel -}}
|
||||
{{- $schema = merge $schema (dict "proficiencyLevel" .) -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- /* Add prerequisites if specified in frontmatter */ -}}
|
||||
{{- with .Params.prerequisites -}}
|
||||
{{- $schema = merge $schema (dict "dependencies" .) -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- /* Add time required if specified in frontmatter */ -}}
|
||||
{{- with .Params.time -}}
|
||||
{{- /* Convert "20 minutes" to ISO 8601 duration "PT20M" */ -}}
|
||||
|
||||
@@ -1,33 +1,19 @@
|
||||
{{- /*
|
||||
Renders a sidebar for pages in the `/guides` section.
|
||||
- Detects if the current page is part of a multipage guide (`.Store.Set "multipage"`).
|
||||
- Displays the section's title, summary, languages, tags, and estimated time (`Params.time`).
|
||||
- Includes a stepper navigation (`guides-stepper.html`) for multipage guides.
|
||||
- Optionally lists resource links from `Params.resource_links`.
|
||||
- Provides a link back to the main `/guides/` index.
|
||||
*/
|
||||
-}}
|
||||
{{- $guide := cond (eq .CurrentSection .FirstSection) . .CurrentSection -}}
|
||||
<div class="flex flex-col gap-4 px-4 pt-2">
|
||||
{{- $root := . }}
|
||||
{{- .Store.Set "multipage" false }}
|
||||
{{- if ne .CurrentSection .FirstSection }}
|
||||
{{- $root = .CurrentSection }}
|
||||
{{- .Store.Set "multipage" true }}
|
||||
{{- end }}
|
||||
<div class="font-semibold">
|
||||
<a href="{{ $root.Permalink }}">{{ $root.Title }}</a>
|
||||
<a href="{{ $guide.Permalink }}">{{ $guide.Title }}</a>
|
||||
</div>
|
||||
<div>{{ $root.Summary }}</div>
|
||||
<div>{{ $guide.Summary }}</div>
|
||||
<div class="space-y-4">
|
||||
<div class="flex flex-wrap gap-2">
|
||||
{{- with ($root.GetTerms "languages") }}
|
||||
{{ partial "languages.html" . }}
|
||||
{{- with $guide.Params.languages }}
|
||||
{{ partial "guide-languages.html" . }}
|
||||
{{- end }}
|
||||
{{- with ($root.GetTerms "tags") }}
|
||||
{{ partial "tags.html" . }}
|
||||
{{- with $guide.Params.tags }}
|
||||
{{ partial "guide-tags.html" . }}
|
||||
{{- end }}
|
||||
</div>
|
||||
{{- with ($root.Params.time) }}
|
||||
{{- with $guide.Params.time }}
|
||||
<div class="flex gap-2 text-gray-400 dark:text-gray-400">
|
||||
<span class="icon-svg"
|
||||
>{{ partialCached "icon" "schedule" "schedule" }}</span
|
||||
@@ -36,10 +22,10 @@
|
||||
</div>
|
||||
{{- end -}}
|
||||
</div>
|
||||
{{- if (.Store.Get "multipage") }}
|
||||
{{- if gt (len $guide.Pages) 0 }}
|
||||
{{- partial "guides-stepper.html" . }}
|
||||
{{- end }}
|
||||
{{- with $root.Params.resource_links }}
|
||||
{{- with $guide.Params.resource_links }}
|
||||
<div class="space-y-2">
|
||||
<p>Resources:</p>
|
||||
<ul class="ml-4 space-y-2">
|
||||
@@ -49,5 +35,5 @@
|
||||
</ul>
|
||||
</div>
|
||||
{{- end }}
|
||||
<a href="/guides/" class="link mt-2">« Back to all guides</a>
|
||||
<a href="/guides/" class="link mt-2">« Back to all guides</a>
|
||||
</div>
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
{{- /*
|
||||
Renders a flat list of tags for the "tags" taxonomy.
|
||||
- Unlike `sections.html`, this template is based on taxonomy terms, not section pages.
|
||||
- Highlights the current tag page and links to all tag pages.
|
||||
*/
|
||||
-}}
|
||||
<ul class="md:text-sm">
|
||||
{{- range site.Taxonomies.tags }}
|
||||
<li
|
||||
class="hover:text-blue {{ if eq .Page page }}
|
||||
bg-gray-400 dark:bg-gray-800
|
||||
{{ end }} pl-4 hover:dark:text-blue-700"
|
||||
>
|
||||
<a
|
||||
class="block w-full truncate py-2"
|
||||
href="{{ .Page.Permalink }}"
|
||||
title="{{ .Page.LinkTitle }}"
|
||||
>
|
||||
{{ .Page.LinkTitle }}
|
||||
</a>
|
||||
</li>
|
||||
{{- end }}
|
||||
</ul>
|
||||
@@ -1,16 +0,0 @@
|
||||
{{- /*
|
||||
List of tag "chips" as links
|
||||
Context: page.Pages
|
||||
*/
|
||||
-}}
|
||||
{{- range . -}}
|
||||
{{- if eq .File nil }}
|
||||
{{- errorf "[tags] Undefined tag: '%s' in %s" (urlize (strings.ToLower .Title)) page.File.Filename }}
|
||||
{{- end }}
|
||||
<a class="chip" href="{{ .Permalink }}">
|
||||
<span class="icon-svg icon-sm pb-0.5">
|
||||
{{ partialCached "icon" "tag" "tag" }}
|
||||
</span>
|
||||
<span>{{ .LinkTitle }}</span>
|
||||
</a>
|
||||
{{- end -}}
|
||||
+5
-1
@@ -53,7 +53,11 @@
|
||||
<!-- Actual Sidebar Content -->
|
||||
{{ block "left" . }}
|
||||
{{ partial "sidebar/mainnav.html" . }}
|
||||
{{ partial "sidebar/sections.html" . }}
|
||||
{{ if eq .Type "guides" }}
|
||||
{{ partial "sidebar/guides.html" . }}
|
||||
{{ else }}
|
||||
{{ partial "sidebar/sections.html" . }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,8 +1,3 @@
|
||||
{{ define "left" }}
|
||||
{{ partial "sidebar/mainnav.html" . }}
|
||||
{{ partial "sidebar/sections.html" . }}
|
||||
{{ end }}
|
||||
|
||||
{{ define "main" }}
|
||||
{{ partial "breadcrumbs.html" . }}
|
||||
<article class="prose max-w-none dark:prose-invert">
|
||||
|
||||
+17
-17
@@ -40,7 +40,7 @@
|
||||
>
|
||||
<div class="pl-2"><strong>Tags</strong></div>
|
||||
<fieldset class="flex flex-col gap-2">
|
||||
{{- range $name, $taxonomy := where site.Taxonomies.tags ".Page.Section" "guides" }}
|
||||
{{- range $name, $data := site.Data.tags }}
|
||||
{{- $id := anchorize (fmt.Printf "tag-%s" $name) }}
|
||||
<div class="flex gap-2 pl-2">
|
||||
<input
|
||||
@@ -51,14 +51,14 @@
|
||||
:checked="filters['tags'].includes('{{ $name }}')"
|
||||
/>
|
||||
<label class="select-none" for="{{ $id }}"
|
||||
>{{ .Page.LinkTitle }}</label
|
||||
>{{ $data.title }}</label
|
||||
>
|
||||
</div>
|
||||
{{ end }}
|
||||
</fieldset>
|
||||
<div class="pl-2"><strong>Languages</strong></div>
|
||||
<fieldset class="flex flex-wrap gap-2 pl-2">
|
||||
{{- range $name, $taxonomy := where site.Taxonomies.languages ".Page.Type" "guides" }}
|
||||
{{- range $name, $data := site.Data.languages }}
|
||||
{{- $id := anchorize (fmt.Printf "lang-%s" $name) }}
|
||||
<button
|
||||
class="border-divider-light dark:border-divider-dark flex gap-1 rounded-full border bg-white px-2 py-1 dark:bg-gray-800"
|
||||
@@ -68,10 +68,10 @@
|
||||
<img
|
||||
height="18"
|
||||
width="18"
|
||||
title="{{ .Page.LinkTitle }}"
|
||||
src="{{ .Page.Params.icon }}"
|
||||
title="{{ $data.title }}"
|
||||
src="{{ $data.icon }}"
|
||||
/>
|
||||
<span>{{ .Page.LinkTitle }}</span>
|
||||
<span>{{ $data.title }}</span>
|
||||
</button>
|
||||
{{ end }}
|
||||
</fieldset>
|
||||
@@ -189,12 +189,12 @@
|
||||
</p>
|
||||
</div>
|
||||
<div class="flex items-center gap-2 pl-4">
|
||||
{{- range $name, $taxonomy := site.Taxonomies.tags }}
|
||||
{{- range $name, $data := site.Data.tags }}
|
||||
<div x-show="filters.tags.includes('{{ $name }}')">
|
||||
{{ template "termchip" $taxonomy.Page.LinkTitle }}
|
||||
{{ template "termchip" $data.title }}
|
||||
</div>
|
||||
{{- end }}
|
||||
{{- range $name, $taxonomy := site.Taxonomies.languages }}
|
||||
{{- range $name, $data := site.Data.languages }}
|
||||
<div
|
||||
x-show="filters.languages.includes('{{ $name }}')"
|
||||
class="border-divider-light dark:border-divider-dark inline-flex items-center gap-1 rounded-full border bg-gray-100 px-2 text-sm text-gray-200 select-none dark:bg-gray-800 dark:text-gray-300"
|
||||
@@ -203,10 +203,10 @@
|
||||
class="py-1"
|
||||
height="18"
|
||||
width="18"
|
||||
title="{{ .Page.LinkTitle }}"
|
||||
src="{{ .Page.Params.icon }}"
|
||||
title="{{ $data.title }}"
|
||||
src="{{ $data.icon }}"
|
||||
/>
|
||||
<span>{{ .Page.LinkTitle }}</span>
|
||||
<span>{{ $data.title }}</span>
|
||||
</div>
|
||||
{{- end }}
|
||||
</div>
|
||||
@@ -241,11 +241,11 @@
|
||||
class="flex items-center justify-between gap-8 text-sm text-gray-400 dark:text-gray-300"
|
||||
>
|
||||
<div class="flex flex-wrap gap-2 md:flex-nowrap">
|
||||
{{- $langs := .GetTerms "languages" }}
|
||||
{{ partial "languages" $langs }}
|
||||
{{- $tags := .GetTerms "tags" }}
|
||||
{{- range $tags }}
|
||||
{{ template "termchip" .Page.LinkTitle }}
|
||||
{{- with .Params.languages }}
|
||||
{{ partial "guide-languages.html" . }}
|
||||
{{- end }}
|
||||
{{- with .Params.tags }}
|
||||
{{ partial "guide-tags.html" . }}
|
||||
{{- end }}
|
||||
</div>
|
||||
{{- with .Params.time }}
|
||||
|
||||
@@ -1,8 +1,3 @@
|
||||
{{ define "left" }}
|
||||
{{ partial "sidebar/mainnav.html" . }}
|
||||
{{ partial "sidebar/guides.html" . }}
|
||||
{{ end }}
|
||||
|
||||
{{ define "main" }}
|
||||
<article class="prose min-w-0 max-w-4xl dark:prose-invert">
|
||||
{{ partial "breadcrumbs.html" . }}
|
||||
@@ -14,7 +9,7 @@
|
||||
{{ .Content }}
|
||||
{{ partial "heading.html" (dict "text" "Modules" "level" 2) }}
|
||||
<ol>
|
||||
{{- range $i, $e := .Pages }}
|
||||
{{- range .Pages }}
|
||||
<li>
|
||||
<a class="link" href="{{ .Permalink }}">{{ .LinkTitle }}</a>
|
||||
<p>{{ plainify .Description }}</p>
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
{{ define "left" }}
|
||||
{{ partial "sidebar/mainnav.html" . }}
|
||||
{{ partial "sidebar/guides.html" . }}
|
||||
{{ end }}
|
||||
|
||||
{{ define "main" }}
|
||||
{{ partial "content-default.html" . }}
|
||||
<div class="prose dark:prose-invert max-w-4xl">
|
||||
{{ if (.Store.Get "multipage") }}
|
||||
{{- with .PrevInSection }}
|
||||
<div class="not-prose col-start-2 my-4">
|
||||
<a
|
||||
href="{{ .Permalink }}"
|
||||
class="cursor-pointer rounded-sm bg-blue-500 px-4 py-2 text-white hover:bg-blue-400 dark:bg-blue-800 dark:hover:bg-blue-700"
|
||||
>{{ .Title }} »</a
|
||||
>
|
||||
</div>
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
</div>
|
||||
{{ end }}
|
||||
@@ -4,8 +4,11 @@
|
||||
{{- $desc := partialCached "utils/description.html" . . -}}
|
||||
{{- $kwd := partialCached "utils/keywords.html" . . -}}
|
||||
{{- $tags := slice -}}
|
||||
{{- range (.GetTerms "tags") -}}
|
||||
{{ $tags = $tags | append .LinkTitle }}
|
||||
{{- range (.Params.tags | default slice) -}}
|
||||
{{- $tagData := index site.Data.tags . -}}
|
||||
{{- with $tagData -}}
|
||||
{{ $tags = $tags | append .title }}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- jsonify (dict "url" .Permalink "title" $title "description" $desc "keywords" $kwd "tags" $tags) -}},
|
||||
{{- end -}}
|
||||
|
||||
@@ -1,8 +1,3 @@
|
||||
{{ define "left" }}
|
||||
{{ partial "sidebar/mainnav.html" . }}
|
||||
{{ partial "sidebar/sections.html" . }}
|
||||
{{ end }}
|
||||
|
||||
{{ define "main" }}
|
||||
{{ partial "breadcrumbs.html" . }}
|
||||
<article class="prose dark:prose-invert max-w-none">
|
||||
|
||||
+32
-7
@@ -3,14 +3,39 @@
|
||||
<article class="prose max-w-none dark:prose-invert">
|
||||
<h1 data-pagefind-weight="10" class="scroll-mt-36">{{ .Title }}</h1>
|
||||
<div class="text-lg">{{ .Summary }}</div>
|
||||
{{ partial "components/guide-summary.html" . }}
|
||||
{{- if or .Params.proficiencyLevel .Params.time .Params.prerequisites }}
|
||||
<div class="not-prose">
|
||||
<div class="mt-1.5 mb-1.5 flex flex-col gap-4 rounded-sm bg-gray-100 p-6 sm:flex-row dark:bg-gray-800">
|
||||
{{- with .Params.proficiencyLevel }}
|
||||
<div class="flex flex-grow flex-col sm:items-center">
|
||||
<span><strong>Skill level</strong></span>
|
||||
<span>{{ . }}</span>
|
||||
</div>
|
||||
{{- end }}
|
||||
{{- with .Params.time }}
|
||||
<div class="flex flex-grow flex-col sm:items-center">
|
||||
<span><strong>Time to complete</strong></span>
|
||||
<span>{{ . }}</span>
|
||||
</div>
|
||||
{{- end }}
|
||||
{{- with .Params.prerequisites }}
|
||||
<div class="flex flex-grow flex-col sm:items-center">
|
||||
<span><strong>Prerequisites</strong></span>
|
||||
<span>{{ . }}</span>
|
||||
</div>
|
||||
{{- end }}
|
||||
</div>
|
||||
</div>
|
||||
{{- end }}
|
||||
{{ .Content }}
|
||||
{{ partial "heading.html" (dict "text" "Modules" "level" 2) }}
|
||||
{{ range $i, $e := .Pages }}
|
||||
{{ $o := compare.Conditional (eq $i 0) true false }}
|
||||
{{ $t := fmt.Printf "%d. %s" (add $i 1) $e.Title }}
|
||||
{{ $b := fmt.Printf "%s\n\n{{< button url=`%s` text=`%s` >}}" $e.Summary $e.Permalink "Start" }}
|
||||
{{ partial "components/accordion.html" (dict "large" true "open" $o "title" $t "body" $b) }}
|
||||
{{ end }}
|
||||
<ol>
|
||||
{{- range .Pages }}
|
||||
<li>
|
||||
<a class="link" href="{{ .Permalink }}">{{ .LinkTitle }}</a>
|
||||
<p>{{ plainify .Description }}</p>
|
||||
</li>
|
||||
{{- end }}
|
||||
</ol>
|
||||
</article>
|
||||
{{ end }}
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
{{ define "left" }}
|
||||
{{ partial "sidebar/mainnav.html" . }}
|
||||
{{ partial "sidebar/tags.html" . }}
|
||||
{{ end }}
|
||||
|
||||
{{ define "main" }}
|
||||
<article class="prose dark:prose-invert max-w-none">
|
||||
{{ partial "breadcrumbs.html" . }}
|
||||
<h1 class="flex items-center">
|
||||
<span class="icon-svg icon-lg pb-2"
|
||||
>{{ partialCached "icon" "tag" "tag" }}</span
|
||||
>
|
||||
<span>{{ .Title }}</span>
|
||||
</h1>
|
||||
{{ .Content }}
|
||||
<ul>
|
||||
{{ range site.Taxonomies.tags }}
|
||||
<li>
|
||||
<a href="{{ .Page.Permalink }}">{{ .Page.Title }}</a>
|
||||
({{ (len .Pages) }} {{ cond (gt (len .Pages) 1) "pages" "page" }})
|
||||
</li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
</article>
|
||||
{{ end }}
|
||||
@@ -1,25 +0,0 @@
|
||||
{{ define "left" }}
|
||||
{{ partial "sidebar/mainnav.html" . }}
|
||||
{{ partial "sidebar/tags.html" . }}
|
||||
{{ end }}
|
||||
|
||||
{{ define "main" }}
|
||||
<article class="prose max-w-none dark:prose-invert">
|
||||
{{ partial "breadcrumbs.html" . }}
|
||||
<h1 class="flex items-center">
|
||||
<span class="icon-svg icon-lg pb-2">{{ partialCached "icon" "tag" "tag" }}</span>
|
||||
</span>{{ .Title }}</span>
|
||||
</h1>
|
||||
{{ .Content }}
|
||||
{{- range .Pages.GroupBy "Type" }}
|
||||
<h2>{{ (site.GetPage .Key).LinkTitle }}</h2>
|
||||
<ul>
|
||||
{{ range .Pages }}
|
||||
<li>
|
||||
<a href="{{ .Permalink }}">{{ .Title }}</a>
|
||||
</li>
|
||||
{{- end }}
|
||||
</ul>
|
||||
{{- end }}
|
||||
</article>
|
||||
{{ end }}
|
||||
Reference in New Issue
Block a user