Merge pull request #20846 from dvdksn/hugo-templates-tidy

chore: tidy up hugo templates
This commit is contained in:
David Karlsson 2024-09-11 17:39:56 +02:00 committed by GitHub
commit 21b37d3696
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
43 changed files with 179 additions and 201 deletions

View File

@ -19,16 +19,18 @@ The front matter of a given page is in a section at the top of the Markdown
file that starts and ends with three hyphens. It includes YAML content. The
following keys are supported. The title, description, and keywords are required.
| Key | Required | Description |
|----------------|----------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| title | yes | The page title. This is added to the HTML output as a `<h1>` level header. |
| description | yes | A sentence that describes the page contents. This is added to the HTML metadata. Its not rendered on the page. |
| keywords | yes | A comma-separated list of keywords. These are added to the HTML metadata. |
| aliases | no | A YAML list of pages which should redirect to the current page. At build time, each page listed here is created as an HTML stub containing a 302 redirect to this page. |
| notoc | no | Either `true` or `false`. If `true`, no in-page TOC is generated for the HTML output of this page. Defaults to `false`. Appropriate for some landing pages that have no in-page headings. |
| toc_min | no | Ignored if `notoc` is set to `true`. The minimum heading level included in the in-page TOC. Defaults to `2`, to show `<h2>` headings as the minimum. |
| toc_max | no | Ignored if `notoc` is set to `false`. The maximum heading level included in the in-page TOC. Defaults to `3`, to show `<h3>` headings. Set to the same as `toc_min` to only show `toc_min` level of headings. |
| sitemap | no | Exclude the page from indexing by search engines. When set to `false`, the page is excluded from `sitemap.xml`, and a `<meta name="robots" content="noindex"/>` header is added to the page. |
| Key | Required | Description |
|-----------------|----------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| title | yes | The page title. This is added to the HTML output as a `<h1>` level header. |
| description | yes | A sentence that describes the page contents. This is added to the HTML metadata. Its not rendered on the page. |
| keywords | yes | A comma-separated list of keywords. These are added to the HTML metadata. |
| aliases | no | A YAML list of pages which should redirect to the current page. At build time, each page listed here is created as an HTML stub containing a 302 redirect to this page. |
| notoc | no | Either `true` or `false`. If `true`, no in-page TOC is generated for the HTML output of this page. Defaults to `false`. Appropriate for some landing pages that have no in-page headings. |
| toc_min | no | Ignored if `notoc` is set to `true`. The minimum heading level included in the in-page TOC. Defaults to `2`, to show `<h2>` headings as the minimum. |
| toc_max | no | Ignored if `notoc` is set to `false`. The maximum heading level included in the in-page TOC. Defaults to `3`, to show `<h3>` headings. Set to the same as `toc_min` to only show `toc_min` level of headings. |
| sitemap | no | Exclude the page from indexing by search engines. When set to `false`, the page is excluded from `sitemap.xml`, and a `<meta name="robots" content="noindex"/>` header is added to the page. |
| sidebar.reverse | no | This parameter for section pages changes the sort order of the pages in that section. Pages that would normally appear at the top, by weight or by title, will instead appear near the bottom, and vice versa. |
| sidebar.goto | no | Set this to change the URL that the sidebar should point to for this entry. See [pageless sidebar entries](#pageless-sidebar-entries). |
Here's an example of a valid (but contrived) page metadata. The order of
the metadata elements in the front matter isn't important.
@ -60,3 +62,19 @@ The body of the page (with the exception of keywords) starts after the front mat
### Text length
Splitting long lines (preferably up to 80 characters) can make it easier to provide feedback on small chunks of text.
## Pageless sidebar entries
If you want to add an entry to the sidebar, but you want the link to point somewhere else, you can use the `sidebar.goto` parameter.
This is useful in combination with `build.render` set to `always`, which creates a pageless entry in the sidebar that links to another page.
```md
---
title: Dummy sidebar link
build:
render: never
sidebar:
goto: /some/other/page/
weight: 30
---
```

View File

@ -1,5 +1,7 @@
---
title: Learning paths
cascade:
layout: wide
description: |
Docker Learning Paths offer structured guides to help you master Docker.
keywords: docker, learning, paths, tutorials, resources

View File

@ -0,0 +1,9 @@
---
build:
render: never
title: Latest (v{{< param latest_engine_api_version >}})
params:
sidebar:
goto: "/reference/api/engine/version/v{{< param latest_engine_api_version >}}"
weight: 20
---

View File

@ -1,8 +0,0 @@
---
title: Latest (v{{< param latest_engine_api_version >}})
weight: 20
---
<html>
<head><meta http-equiv="refresh" content="0;url=/reference/api/engine/version/v{{< param latest_engine_api_version >}}/" /></head>
<body><p>Redirecting to the latest version of the Docker Engine API reference.</body>
</html>

View File

@ -4,4 +4,7 @@ build:
render: never
sidebar:
reverse: true
cascade:
description: Reference documentation and Swagger (OpenAPI) specification for the Docker Engine API.
layout: api
---

View File

@ -1,6 +1,6 @@
---
title: v1.25
layout: engine-api
title: Docker Engine API v1.25 reference
linkTitle: v1.25
aliases:
- /engine/api/v1.25/
---

View File

@ -1,6 +1,6 @@
---
title: v1.26
layout: engine-api
linkTitle: v1.26
title: Docker Engine API v1.26 reference
aliases:
- /engine/api/v1.26/
---

View File

@ -1,6 +1,6 @@
---
title: v1.27
layout: engine-api
linkTitle: v1.27
title: Docker Engine API v1.27 reference
aliases:
- /engine/api/v1.27/
---

View File

@ -1,6 +1,6 @@
---
title: v1.28
layout: engine-api
linkTitle: v1.28
title: Docker Engine API v1.28 reference
aliases:
- /engine/api/v1.28/
---

View File

@ -1,6 +1,6 @@
---
title: v1.29
layout: engine-api
linkTitle: v1.29
title: Docker Engine API v1.29 reference
aliases:
- /engine/api/v1.29/
---

View File

@ -1,6 +1,6 @@
---
title: v1.30
layout: engine-api
linkTitle: v1.30
title: Docker Engine API v1.30 reference
aliases:
- /engine/api/v1.30/
---

View File

@ -1,6 +1,6 @@
---
title: v1.31
layout: engine-api
linkTitle: v1.31
title: Docker Engine API v1.31 reference
aliases:
- /engine/api/v1.31/
---

View File

@ -1,6 +1,6 @@
---
title: v1.32
layout: engine-api
linkTitle: v1.32
title: Docker Engine API v1.32 reference
aliases:
- /engine/api/v1.32/
---

View File

@ -1,6 +1,6 @@
---
title: v1.33
layout: engine-api
linkTitle: v1.33
title: Docker Engine API v1.33 reference
aliases:
- /engine/api/v1.33/
---

View File

@ -1,6 +1,6 @@
---
title: v1.34
layout: engine-api
linkTitle: v1.34
title: Docker Engine API v1.34 reference
aliases:
- /engine/api/v1.34/
---

View File

@ -1,6 +1,6 @@
---
title: v1.35
layout: engine-api
linkTitle: v1.35
title: Docker Engine API v1.35 reference
aliases:
- /engine/api/v1.35/
---

View File

@ -1,6 +1,6 @@
---
title: v1.36
layout: engine-api
linkTitle: v1.36
title: Docker Engine API v1.36 reference
aliases:
- /engine/api/v1.36/
---

View File

@ -1,6 +1,6 @@
---
title: v1.37
layout: engine-api
linkTitle: v1.37
title: Docker Engine API v1.37 reference
aliases:
- /engine/api/v1.37/
---

View File

@ -1,6 +1,6 @@
---
title: v1.38
layout: engine-api
linkTitle: v1.38
title: Docker Engine API v1.38 reference
aliases:
- /engine/api/v1.38/
---

View File

@ -1,6 +1,6 @@
---
title: v1.39
layout: engine-api
linkTitle: v1.39
title: Docker Engine API v1.39 reference
aliases:
- /engine/api/v1.39/
---

View File

@ -1,6 +1,6 @@
---
title: v1.40
layout: engine-api
linkTitle: v1.40
title: Docker Engine API v1.40 reference
aliases:
- /engine/api/v1.40/
---

View File

@ -1,6 +1,6 @@
---
title: v1.41
layout: engine-api
linkTitle: v1.41
title: Docker Engine API v1.41 reference
aliases:
- /engine/api/v1.41/
---

View File

@ -1,6 +1,6 @@
---
title: v1.42
layout: engine-api
linkTitle: v1.42
title: Docker Engine API v1.42 reference
aliases:
- /engine/api/v1.42/
---

View File

@ -1,6 +1,6 @@
---
title: v1.43
layout: engine-api
linkTitle: v1.43
title: Docker Engine API v1.43 reference
aliases:
- /engine/api/v1.43/
---

View File

@ -1,6 +1,6 @@
---
title: v1.44
layout: engine-api
linkTitle: v1.44
title: Docker Engine API v1.44 reference
aliases:
- /engine/api/v1.44/
---

View File

@ -1,6 +1,6 @@
---
title: v1.45
layout: engine-api
linkTitle: v1.45
title: Docker Engine API v1.45 reference
aliases:
- /engine/api/v1.45/
---

View File

@ -1,6 +1,6 @@
---
title: v1.46
layout: engine-api
linkTitle: v1.46
title: Docker Engine API v1.46 reference
aliases:
- /engine/api/v1.46/
---

View File

@ -1,4 +1,6 @@
---
title: v1.47
layout: engine-api
linkTitle: v1.47
title: Docker Engine API v1.47 reference
aliases:
- /reference/api/engine/latest/
---

View File

@ -1,4 +1,6 @@
---
layout: hub-api
title: Docker Verified Publisher API
layout: api
description: Reference documentation and Swagger (OpenAPI) specification for the Docker Verified Publisher API.
linkTitle: DVP Data API
title: Docker Verified Publisher API reference
---

View File

@ -1,4 +1,6 @@
---
layout: hub-api
title: Docker Hub API
layout: api
description: Reference documentation and Swagger (OpenAPI) specification for the Docker Hub API.
title: Docker Hub API reference
linkTitle: Docker Hub API
---

View File

@ -1,5 +1,7 @@
---
title: Tags
cascade:
layout: wide
---
Here you can browse Docker docs by tag.

View File

@ -262,7 +262,7 @@ module:
- source: docs/api/version-history.md
target: content/reference/api/engine/version-history.md
- source: docs/api
target: static/reference/api/engine
target: content/reference/api/engine/version
includeFiles: "*.yaml"
- path: github.com/moby/buildkit

View File

@ -317,7 +317,6 @@
"hover:text-black",
"hover:text-blue-light",
"hover:underline",
"hub-api",
"icon-lg",
"icon-sm",
"icon-svg",

View File

@ -0,0 +1,31 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>{{ .Title }}</title>
<!-- needed for adaptive design -->
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="description" content="{{ .Description }}" />
<meta charset="utf-8" />
<!-- favicon -->
{{- partialCached "favicon.html" "favicon" }}
<style>
body {
margin: 0;
padding: 0;
}
.menu-content>div:first-child {
background-color: #086dd7;
padding: 16px;
}
</style>
</head>
<body>
{{ $specURL := urls.Parse (printf "/%s%s.yaml" .File.Dir .File.ContentBaseName) }}
<redoc spec-url="{{ $specURL.String }}" hide-hostname="true" suppress-warnings="true" lazy-rendering></redoc>
<script src="https://cdn.redoc.ly/redoc/latest/bundles/redoc.standalone.js"></script>
</body>
</html>

View File

@ -1,34 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Docker Engine API {{ .File.BaseFileName }} Reference</title>
<!-- needed for adaptive design -->
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="description"
content="Reference documentation and Swagger (OpenAPI) specification for the {{ .File.BaseFileName }} version of the API served by Docker Engine." />
<meta charset="utf-8" />
<!-- favicon -->
{{ partialCached "favicon.html" "favicon" }}
<!-- make the latest API version the canonical page as that's what we want users to be using mostly -->
<link rel="canonical" href="{{ site.BaseURL }}/reference/api/engine/version/v{{ site.Params.latest_engine_api_version }}/" />
<style>
body {
margin: 0;
padding: 0;
}
.menu-content>div:first-child {
background-color: #086dd7;
padding: 16px;
}
</style>
</head>
<body>
<redoc spec-url="/reference/api/engine/{{ .File.BaseFileName }}.yaml" hide-hostname="true" suppress-warnings="true"
lazy-rendering></redoc>
<script src="https://cdn.redoc.ly/redoc/latest/bundles/redoc.standalone.js"></script>
</body>
</html>

View File

@ -1,33 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Docker Hub API Reference {{ .File.BaseFileName }}</title>
<!-- needed for adaptive design -->
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="description"
content="Reference documentation and Swagger (OpenAPI) specification for the {{ .File.BaseFileName }} API served by Docker Hub." />
<meta charset="utf-8" />
<!-- favicon -->
{{ partialCached "favicon.html" "favicon" }}
<!-- make the latest API version the canonical page as that's what we want users to be using mostly -->
<link rel="canonical" href="{{ "/reference/api/hub/latest/" | relURL }}" />
<style>
body {
margin: 0;
padding: 0;
}
.menu-content>div:first-child {
background-color: #086dd7;
padding: 16px;
}
</style>
</head>
<body>
<redoc spec-url="/reference/api/hub/{{ .File.BaseFileName }}.yaml" class="hub-api"></redoc>
<script src="https://cdn.redoc.ly/redoc/latest/bundles/redoc.standalone.js"></script>
</body>
</html>

View File

@ -1,5 +1,24 @@
<aside class="py-4 space-y-4">
<div id="TableOfContents">
{{ partial "toc-cli.html" . }}
<div class="text-lg pb-2">{{ T "tableOfContents" }}</div>
<nav class="toc">
<ul>
{{ range (.Scratch.Get "headings") }}
{{/* add left padding depending on level (pl-2, pl-3, pl-4) */}}
{{ $slice := strings.Split .text "{#" }}
{{ $text := index $slice 0 }}
{{ $anchor := index $slice 1 | strings.TrimRight "}" }}
<li{{ with .level }} class="pl-{{ . }}"{{ end }}>
<a
{{ if $anchor }}
href="#{{ $anchor }}"
{{ else }}
href="#{{ $text | anchorize }}"
{{ end }}
>{{ markdownify $text }}</a>
</li>
{{ end }}
</ul>
</nav>
</div>
</aside>

View File

@ -16,7 +16,15 @@
</div>
</a>
</div>
{{ partial "top-nav.html" . }}
<nav>
<ul class="mt-1 box-content hidden gap-4 md:flex">
{{ range site.Menus.main }}
<li {{- if or (eq page .Page) (page.IsDescendant .Page) }} class="border-b-4" {{- end }}>
<a class="block px-2 py-1" href="{{ .URL }}">{{ .Name }}</a>
</li>
{{ end }}
</ul>
</nav>
</div>
<div class="flex items-center gap-6">
{{ partialCached "search.html" "-" }}

View File

@ -71,12 +71,22 @@
{{ end }}
{{ define "renderSingle" }}
{{ $isCurrent := eq page . }}
<li class="pl-4 hover:text-blue-light hover:dark:text-blue-dark
{{ if $isCurrent }} bg-gray-light-200 dark:bg-gray-dark-200{{ end }}">
<a {{ if $isCurrent }}aria-current="page" {{ end }} class="py-2 w-full truncate block"
href="{{ .Permalink }}" title="{{ markdownify .Title }}"
><span class="flex items-center gap-2">{{ markdownify .LinkTitle }}</span>
</a>
</li>
{{- if .Params.goto }}
<li class="pl-4 hover:text-blue-light hover:dark:text-blue-dark">
<a class="py-2 w-full truncate block"
href="{{ markdownify .Params.goto }}"
title="{{ markdownify .Title }}">
<span class="flex items-center gap-2">{{ markdownify .LinkTitle }}</span>
</a>
</li>
{{- else }}
{{ $isCurrent := eq page . }}
<li class="pl-4 hover:text-blue-light hover:dark:text-blue-dark
{{ if $isCurrent }} bg-gray-light-200 dark:bg-gray-dark-200{{ end }}">
<a {{ if $isCurrent }}aria-current="page" {{ end }} class="py-2 w-full truncate block"
href="{{ .Permalink }}" title="{{ markdownify .Title }}"
><span class="flex items-center gap-2">{{ markdownify .LinkTitle }}</span>
</a>
</li>
{{- end }}
{{ end }}

View File

@ -1,20 +0,0 @@
<div class="text-lg pb-2">{{ T "tableOfContents" }}</div>
<nav class="toc">
<ul>
{{ range (.Scratch.Get "headings") }}
{{/* add left padding depending on level (pl-2, pl-3, pl-4) */}}
{{ $slice := strings.Split .text "{#" }}
{{ $text := index $slice 0 }}
{{ $anchor := index $slice 1 | strings.TrimRight "}" }}
<li{{ with .level }} class="pl-{{ . }}"{{ end }}>
<a
{{ if $anchor }}
href="#{{ $anchor }}"
{{ else }}
href="#{{ $text | anchorize }}"
{{ end }}
>{{ markdownify $text }}</a>
</li>
{{ end }}
</ul>
</nav>

View File

@ -1,11 +0,0 @@
<div>
<nav>
<ul class="mt-1 box-content hidden gap-4 md:flex">
{{ range site.Menus.main }}
<li {{- if or (eq page .Page) (page.IsDescendant .Page) }} class="border-b-4" {{- end }}>
<a class="block px-2 py-1" href="{{ .URL }}">{{ .Name }}</a>
</li>
{{ end }}
</ul>
</nav>
</div>

View File

@ -1,23 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
{{ partial "head.html" . }}
</head>
<body class="flex flex-col min-h-screen bg-background-light text-base dark:bg-background-dark dark:text-white">
{{ partial "header.html" . }}
<main class="flex justify-center">
<div class="lg:w-[1200px] overflow-clip p-6 pt-0 w-lvw">
{{ block "main" . }}
{{ end }}
</div>
</main>
<footer class="mt-auto">{{ partialCached "footer.html" . }}</footer>
{{/* Load the YouTube player if the page embeds a YouTube video */}}
{{ with .Store.Get "youtube" }}
{{- partial "youtube-script.html" . }}
{{ end }}
</body>
</html>