diff --git a/content/contribute/file-conventions.md b/content/contribute/file-conventions.md index 8f260e8705..4abf27d88c 100644 --- a/content/contribute/file-conventions.md +++ b/content/contribute/file-conventions.md @@ -31,6 +31,7 @@ following keys are supported. The title, description, and keywords are required. | sitemap | no | Exclude the page from indexing by search engines. When set to `false`, the page is excluded from `sitemap.xml`, and a `` 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). | +| sidebar.badge | no | Set this to add a badge to the sidebar entry for this page. This param option consists of two fields: `badge.text` and `badge.color`. | Here's an example of a valid (but contrived) page metadata. The order of the metadata elements in the front matter isn't important. diff --git a/content/manuals/build/checks.md b/content/manuals/build/checks.md index 1ee5eda9e2..201b9ce956 100644 --- a/content/manuals/build/checks.md +++ b/content/manuals/build/checks.md @@ -1,6 +1,11 @@ --- title: Checking your build configuration -linkTitle: Build checks {{< badge color="green" text="New" >}} +linkTitle: Build checks +params: + sidebar: + badge: + color: green + text: New weight: 30 description: Learn how to use build checks to validate your build configuration. keywords: build, buildx, buildkit, checks, validate, configuration, lint diff --git a/content/manuals/copilot/index.md b/content/manuals/copilot/index.md index aeb2e4387c..b563ffac81 100644 --- a/content/manuals/copilot/index.md +++ b/content/manuals/copilot/index.md @@ -1,6 +1,11 @@ --- title: Docker for GitHub Copilot -linkTitle: Docker for GitHub Copilot {{< badge color="violet" text="Early Access" >}} +linkTitle: Docker for GitHub Copilot +params: + sidebar: + badge: + color: violet + text: Early Access weight: 100 description: Learn how to use the Docker Extension for GitHub Copilot to streamline Docker-related tasks. keywords: Docker, GitHub Copilot, extension, Visual Studio Code, chat, ai, containerization diff --git a/layouts/partials/sidebar.html b/layouts/partials/sidebar.html index 95ae36cd2c..f7b4b57eb3 100644 --- a/layouts/partials/sidebar.html +++ b/layouts/partials/sidebar.html @@ -46,12 +46,14 @@ {{- if .Permalink }} {{/* If the link is not empty, use it */}} {{ markdownify .LinkTitle }} + href="{{ .Permalink }}"> + {{ template "renderTitle" . }} + {{- else }} {{/* Otherwise, just expand the section */}} {{- end }} @@ -76,7 +78,9 @@ - {{ markdownify .LinkTitle }} + + {{ template "renderTitle" . }} + {{- else }} @@ -85,8 +89,17 @@ {{ if $isCurrent }} bg-gray-light-200 dark:bg-gray-dark-200{{ end }}"> {{ markdownify .LinkTitle }} + > + {{ template "renderTitle" . }} + {{- end }} {{ end }} + +{{ define "renderTitle" }} + {{ .LinkTitle }} + {{- with .Params.sidebar.badge }} + {{- partial "components/badge.html" (dict "color" .color "content" .text) }} + {{- end }} +{{ end }}