Misc adjustments

This commit is contained in:
Bjørn Erik Pedersen 2025-02-08 16:30:00 +01:00
parent eb5842566f
commit 5accec5f16
41 changed files with 288 additions and 181 deletions

View File

@ -4,7 +4,7 @@
[codespell] [codespell]
# Comma separated list of dirs to be skipped. # Comma separated list of dirs to be skipped.
skip = _vendor,.cspell.json skip = _vendor,.cspell.json,chroma.css,chroma_dark.css
# Comma separated list of words to be ignored. Words must be lowercased. # Comma separated list of words to be ignored. Words must be lowercased.
ignore-words-list = abl,edn,te,ue,trys,januar,womens,crossreferences ignore-words-list = abl,edn,te,ue,trys,januar,womens,crossreferences

View File

@ -11,10 +11,14 @@
@apply text-gray-400; @apply text-gray-400;
} }
.highlight code {
@apply text-sm;
}
.content { .content {
@apply prose prose-stone max-w-none dark:prose-invert dark:text-slate-400; @apply prose prose-sm sm:prose-base prose-stone max-w-none dark:prose-invert dark:text-slate-200;
/* headings */ /* headings */
@apply prose-h6:font-bold; @apply prose-h4:font-bold prose-h5:font-bold prose-h6:font-bold;
/* lead */ /* lead */
@apply prose-lead:text-slate-500 prose-lead:text-xl prose-lead:mt-2 sm:prose-lead:mt-4 prose-lead:leading-relaxed dark:prose-lead:text-slate-400; @apply prose-lead:text-slate-500 prose-lead:text-xl prose-lead:mt-2 sm:prose-lead:mt-4 prose-lead:leading-relaxed dark:prose-lead:text-slate-400;
/* links */ /* links */
@ -23,12 +27,16 @@
/* pre */ /* pre */
@apply prose-pre:text-gray-800 prose-pre:border-1 prose-pre:border-gray-100 prose-pre:bg-light dark:prose-pre:bg-dark dark:prose-pre:ring-1 dark:prose-pre:ring-slate-300/10; @apply prose-pre:text-gray-800 prose-pre:border-1 prose-pre:border-gray-100 prose-pre:bg-light dark:prose-pre:bg-dark dark:prose-pre:ring-1 dark:prose-pre:ring-slate-300/10;
/* code */ /* code */
@apply prose-code:px-0.5 prose-code:text-gray-900 prose-code:dark:text-gray-300 border-none; @apply prose-code:px-0.5 prose-code:text-gray-500 prose-code:dark:text-gray-300 border-none;
@apply prose-code:before:hidden prose-code:after:hidden prose-code:font-mono; @apply prose-code:before:hidden prose-code:after:hidden prose-code:font-mono;
/* tables */ /* tables */
@apply prose-table:border-2 prose-table:border-gray-100 prose-table:dark:border-gray-800 prose-table:relative prose-table:overflow-scroll prose-table:prose-th:font-bold prose-table:prose-th:bg-blue-500 dark:prose-table:prose-th:bg-blue-500/50 prose-table:prose-th:p-2 prose-table:prose-td:p-2 prose-table:prose-th:text-white; @apply prose-table:border-2 prose-table:border-gray-100 prose-table:dark:border-gray-800 prose-table:relative prose-table:overflow-scroll prose-table:prose-th:font-bold prose-table:prose-th:bg-blue-500 dark:prose-table:prose-th:bg-blue-500/50 prose-table:prose-th:p-2 prose-table:prose-td:p-2 prose-table:prose-th:text-white;
/* hr */ /* hr */
@apply dark:prose-hr:border-slate-800; @apply dark:prose-hr:border-slate-800;
h6 + * {
@apply mt-2;
}
} }
/* This will not match highlighting inside e.g. the code-toggle shortcode. */ /* This will not match highlighting inside e.g. the code-toggle shortcode. */

View File

@ -12,7 +12,7 @@ export const explorer = (Alpine) => ({
// The state of each node in the tree. // The state of each node in the tree.
nodes: {}, nodes: {},
// We currenty only list the sections, not regular pages, in the side bar. // We currently only list the sections, not regular pages, in the side bar.
// This strikes me as the right balance. The pages gets listed on the section pages. // This strikes me as the right balance. The pages gets listed on the section pages.
// This array is sorted by length, so we can find the longest prefix of the current page // This array is sorted by length, so we can find the longest prefix of the current page
// without having to iterate over all the keys. // without having to iterate over all the keys.

View File

@ -1,12 +1,10 @@
export const navbar = (Alpine) => ({ export const navbar = (Alpine) => ({
atTop: true,
init: function () { init: function () {
Alpine.bind(this.$root, this.root); Alpine.bind(this.$root, this.root);
}, },
root: { root: {
['@scroll.window.debounce.10ms'](event) { ['@scroll.window.debounce.10ms'](event) {
this.atTop = window.scrollY < 40 ? true : false; this.$store.nav.scroll.atTop = window.scrollY < 40 ? true : false;
}, },
}, },
}); });

View File

@ -16,6 +16,12 @@ export const toc = (Alpine) => ({
}, },
init() { init() {
this.$watch('$store.nav.scroll.atTop', (value) => {
if (!value) return;
this.activeHeading = '';
this.$root.scrollTop = 0;
});
return this.$nextTick(() => { return this.$nextTick(() => {
let contentEl = document.getElementById('content'); let contentEl = document.getElementById('content');
if (contentEl) { if (contentEl) {

View File

@ -6,10 +6,17 @@ export function registerMagics(Alpine) {
if (!el) { if (!el) {
el = currentEl; el = currentEl;
} }
let lntds = el.querySelectorAll('.lntable .lntd');
if (lntds && lntds.length === 2) { // Select the element to copy.
el = lntds[1]; let range = document.createRange();
} range.selectNode(el);
window.getSelection().removeAllRanges();
window.getSelection().addRange(range);
// Remove the selection after some time.
setTimeout(() => {
window.getSelection().removeAllRanges();
}, 500);
// Trim whitespace. // Trim whitespace.
let text = el.textContent.trim(); let text = el.textContent.trim();

View File

@ -27,6 +27,10 @@ export const navStore = (Alpine) => ({
destroy() {}, destroy() {},
scroll: {
atTop: true,
},
userSettings: { userSettings: {
// settings gets persisted between page navigations. // settings gets persisted between page navigations.
settings: Alpine.$persist({ settings: Alpine.$persist({

View File

@ -4,6 +4,11 @@ import { scrollToActive } from 'js/helpers/index';
// Now we know that the browser has JS enabled. // Now we know that the browser has JS enabled.
document.documentElement.classList.remove('no-js'); document.documentElement.classList.remove('no-js');
// Add os-macos class to body if user is using macOS.
if (navigator.userAgent.indexOf('Mac') > -1) {
document.documentElement.classList.add('os-macos');
}
// Wait for the DOM to be ready. // Wait for the DOM to be ready.
document.addEventListener('DOMContentLoaded', function () { document.addEventListener('DOMContentLoaded', function () {
scrollToActive('DOMContentLoaded'); scrollToActive('DOMContentLoaded');

View File

@ -1,6 +1,6 @@
--- ---
title: About Hugo title: About Hugo
linktitle: About
description: Learn about Hugo and its features, security model, and privacy protections. description: Learn about Hugo and its features, security model, and privacy protections.
categories: [] categories: []
keywords: [] keywords: []

View File

@ -1,6 +1,6 @@
--- ---
title: Contribute to the Hugo project title: Contribute to the Hugo project
linktitle: Contribute
description: Contribute to Hugo development, documentation, and themes. description: Contribute to Hugo development, documentation, and themes.
categories: [] categories: []
keywords: [] keywords: []

View File

@ -1,6 +1,6 @@
--- ---
title: Hugo Documentation title: Hugo Documentation
linkTitle: Hugo linkTitle: Docs
description: Hugo is the world's fastest static website engine. It's written in Go (aka Golang) and developed by bep, spf13 and friends. description: Hugo is the world's fastest static website engine. It's written in Go (aka Golang) and developed by bep, spf13 and friends.
menu: menu:
main: main:

View File

@ -1,5 +1,6 @@
--- ---
title: External learning resources title: External learning resources
linkTitle: External resources
description: Use these third-party resources to learn Hugo. description: Use these third-party resources to learn Hugo.
categories: [getting started] categories: [getting started]
keywords: [books, tutorials, learning, usage] keywords: [books, tutorials, learning, usage]

View File

@ -1,6 +1,6 @@
--- ---
title: Quick reference guides title: Quick reference guides
linktitle: Quick reference
description: Use these quick reference guides for quick access to key information. description: Use these quick reference guides for quick access to key information.
categories: [] categories: []
keywords: [] keywords: []

22
data/sponsors.toml Normal file
View File

@ -0,0 +1,22 @@
[[banners]]
name = "Linode"
link = "https://www.linode.com/"
logo = "images/sponsors/linode-logo.svg"
utm_campaign = "hugosponsor"
bgcolor = "#ffffff"
[[banners]]
name = "GoLand"
title = "The complete IDE crafted for professional Go developers."
no_query_params = true
link = "https://www.jetbrains.com/go/?utm_source=OSS&utm_medium=referral&utm_campaign=hugo"
logo = "images/sponsors/goland.svg"
bgcolor = "#f4f4f4"
[[banners]]
name = "Your Company?"
link = "https://bep.is/en/hugo-sponsor-2023-01/"
utm_campaign = "hugosponsor"
show_on_hover = true
bgcolor = "#4e4f4f"
link_attr = "style='color: #ffffff; font-weight: bold; text-decoration: none; text-align: center'"

View File

@ -14,7 +14,7 @@
</title> </title>
<style> <style>
[x-cloak] { [x-cloak] {
display: none; display: none !important;
} }
</style> </style>
<meta <meta
@ -46,7 +46,7 @@
{{ end }} {{ end }}
<div class="flex w-full xl:w-6xl h-full flex-auto mx-auto"> <div class="flex w-full xl:w-6xl h-full flex-auto mx-auto">
<main <main
class="flex-1 mx-auto lg:mx-0 w-full max-w-3x lg:max-w-3x py-8 lg:py-14 px-main"> class="flex-1 mx-auto lg:mx-0 w-full max-w-3x lg:max-w-3x pt-8 lg:pt-14 pb-20 px-main">
{{ block "main" . }}{{ end }} {{ block "main" . }}{{ end }}
</main> </main>
{{ block "rightsidebar" . }} {{ block "rightsidebar" . }}

View File

@ -2,7 +2,7 @@
{{ $pages := "" }} {{ $pages := "" }}
{{ $showDate := false }} {{ $showDate := false }}
{{ if .IsPage }} {{ if .IsPage }}
{{/* We currently have a slightly odd content structure with no top level /docs sectin. */}} {{/* We currently have a slightly odd content structure with no top level /docs section. */}}
{{ $pages = .CurrentSection.Pages }} {{ $pages = .CurrentSection.Pages }}
{{ else }} {{ else }}
{{ if eq .Section "news" }} {{ if eq .Section "news" }}

View File

@ -11,34 +11,38 @@
{{ $t := debug.Timer "single.categories" }} {{ $t := debug.Timer "single.categories" }}
{{ $tags := .GetTerms "categories" }} {{ $tags := .GetTerms "categories" }}
{{ range $tags }} {{ with $tags }}
{{ $text := .LinkTitle }} <div class="mb-4 sm:mb-6 flex flex-wrap gap-2">
{{ $class := "" }} {{ range . }}
{{ range (slice true false ) }} {{ $text := .LinkTitle }}
{{ $color := partial "helpers/funcs/color-from-string.html" (dict "text" $text "dark" . ) }} {{ $class := "" }}
{{ range (slice true false ) }}
{{ $color := partial "helpers/funcs/color-from-string.html" (dict "text" $text "dark" . "--single" "green" ) }}
{{ $prefix := "" }} {{ $prefix := "" }}
{{ if . }} {{ if . }}
{{ $prefix = "dark:" }} {{ $prefix = "dark:" }}
{{ end }}
{{ $class = printf "%sbg-%s-%d %stext-%s-%d border %sborder-%s-%d"
$prefix $color.color $color.shade1
$prefix $color.color $color.shade2
$prefix $color.color $color.shade3
}}
{{ end }}
<a
href="{{ .RelPermalink }}"
class="{{ $class }} text-xs h-auto tracking-widest uppercase font-light not-prose no-underline inline-block py-1 px-3 rounded-xl shadow-xs hover:opacity-80 hover:shadow-none">
{{ .LinkTitle }}
</a>
{{ end }} {{ end }}
{{ $class = printf "%sbg-%s-%d %stext-%s-%d border %sborder-%s-%d" </div>
$prefix $color.color $color.shade1
$prefix $color.color $color.shade2
$prefix $color.color $color.shade2
}}
{{ end }}
<a
href="{{ .RelPermalink }}"
class="{{ $class }} not-prose text-xs font-semibold no-underline inline-block py-1 px-2 rounded-sm uppercase last:mr-0 mr-1 hover:opacity-75 hover:shadow-none">
{{ .LinkTitle | upper }}
</a>
{{ end }} {{ end }}
{{ $t.Stop }} {{ $t.Stop }}
{{ if .Params.action.signatures }} {{ if .Params.action.signatures }}
<div class="mb-6 sm:mb-8 not-prose"> <div class="mb-4 not-prose">
{{- partial "docs/functions-signatures.html" . -}} {{- partial "docs/functions-signatures.html" . -}}
{{- partial "docs/functions-return-type.html" . -}} {{- partial "docs/functions-return-type.html" . -}}
{{- partial "docs/functions-aliases.html" . -}} {{- partial "docs/functions-aliases.html" . -}}
@ -56,9 +60,12 @@
{{ end }} {{ end }}
{{ define "rightsidebar_content" }} {{ define "rightsidebar_content" }}
{{/* in-this-section.html depends on these being reneredc first. */}}
{{ $related := partial "layouts/related.html" . }}
{{ $toc := partial "layouts/toc.html" . }}
{{ if not .Params.hide_in_this_section }} {{ if not .Params.hide_in_this_section }}
{{ partial "layouts/in-this-section.html" . }} {{ partial "layouts/in-this-section.html" . }}
{{ end }} {{ end }}
{{ partial "layouts/related.html" . }} {{ $related }}
{{ partial "layouts/toc.html" . }} {{ $toc }}
{{ end }} {{ end }}

View File

@ -35,7 +35,7 @@
> >
{{ end }} {{ end }}
<div class="-my-5 mr-6 sm:mr-8 md:mr-0"> <div class="-my-5 mr-6 sm:mr-8 md:mr-0">
{{ partial "layouts/search/input-standalone.html" . }} {{ partial "layouts/search/button.html" (dict "page" . "standalone" true) }}
</div> </div>
</div> </div>
</div> </div>

View File

@ -5,7 +5,7 @@
{{- end }} {{- end }}
<p class="font-bold text-dark dark:text-light mt-2">{{ $label }}</p> <p class="font-bold text-dark dark:text-light mt-2">{{ $label }}</p>
{{- range . }} {{- range . }}
<div class="font-sm font-mono px-3 p-2 ml-4 sm:ml-8 mt-0 sm:mt-2"> <div class="font-sm font-mono ml-3 sm:ml-6 mt-0 sm:mt-1">
{{- . -}} {{- . -}}
</div> </div>
{{- end }} {{- end }}

View File

@ -1,6 +1,6 @@
{{- with .Params.action.returnType }} {{- with .Params.action.returnType }}
<p class="font-bold text-dark dark:text-light mt-2">Returns</p> <p class="font-bold text-dark dark:text-light mt-2">Returns</p>
<div class="font-sm font-mono px-3 p-2 ml-4 sm:ml-8 mt-0 sm:mt-2"> <div class="font-sm font-mono ml-3 sm:ml-6 mt-0 sm:mt-1">
{{- . -}} {{- . -}}
</div> </div>
{{- end -}} {{- end -}}

View File

@ -5,7 +5,7 @@
{{- if $.Params.function.returnType }} {{- if $.Params.function.returnType }}
{{- $signature = printf "%s ⟼ %s" . $.Params.function.returnType }} {{- $signature = printf "%s ⟼ %s" . $.Params.function.returnType }}
{{- end }} {{- end }}
<div class="font-sm font-mono px-3 p-2 ml-4 sm:ml-8 mt-0 sm:mt-2"> <div class="font-sm font-mono ml-3 sm:ml-6 mt-0 sm:mt-1">
{{- $signature -}} {{- $signature -}}
</div> </div>
{{- end }} {{- end }}

View File

@ -1,7 +1,11 @@
{{ $colors := slice "blue" "orange" "green" "pink" }} {{ $colors := slice "slate" "green" "cyan" "blue" }}
{{ $shades := slice 200 300 500 }} {{ with .single }}
{{ if .dark }} {{ $colors = slice . }}
{{ $shades = slice 700 800 900 }} {{ end }}
{{ $shades := slice 300 400 500 }}
{{ if not .dark }}
{{ $shades = slice 700 800 }}
{{ end }} {{ end }}
{{ $hash := (hash.FNV32a .text) }} {{ $hash := (hash.FNV32a .text) }}
{{ $i := mod $hash (len $colors) }} {{ $i := mod $hash (len $colors) }}
@ -9,10 +13,13 @@
{{ $color := index $colors $i }} {{ $color := index $colors $i }}
{{ $shade1 := index $shades $j }} {{ $shade1 := index $shades $j }}
{{ $shade2 := 0 }} {{ $shade2 := 0 }}
{{ if gt $shade1 400 }} {{ $shade3 := 0 }}
{{ $shade2 = math.Min (sub $shade1 400) 100 | int }} {{ if gt $shade1 500 }}
{{ $shade2 = math.Min (sub $shade1 500) 100 | int }}
{{ $shade3 = sub $shade1 100 }}
{{ else }} {{ else }}
{{ $shade2 = math.Max (add $shade1 400) 800 | int }} {{ $shade2 = math.Max (add $shade1 500) 700 | int }}
{{ $shade3 = add $shade1 200 }}
{{ end }} {{ end }}
{{ $res := dict "color" $color "shade1" $shade1 "shade2" $shade2 }} {{ $res := dict "color" $color "shade1" $shade1 "shade2" $shade2 "shade3" $shade3 }}
{{ return $res }} {{ return $res }}

View File

@ -13,11 +13,11 @@
</div> </div>
<div class="ml-3"> <div class="ml-3">
{{ with $title }} {{ with $title }}
<h3 class="text-base font-medium text-{{ $color }}-800"> <h3 class="text-{{ $color }}-800">
{{ . }} {{ . }}
</h3> </h3>
{{ end }} {{ end }}
<div class="mt-2 text-base"> <div class="mt-2">
<p> <p>
{{ $text }} {{ $text }}
</p> </p>

View File

@ -5,11 +5,12 @@
<div <div
x-cloak x-cloak
x-show="open" x-show="open"
x-transition.opacity.duration.200ms x-transition:enter.opacity.duration.200ms
x-transition:leave.opacity.duration.300ms
x-trap.inert.noscroll="open" x-trap.inert.noscroll="open"
@keydown.esc.window="open = false" @keydown.esc.window="open = false"
@click.self="open = false" @click.self="open = false"
class="fixed inset-0 z-30 flex items-end justify-center bg-black/50 pb-8 backdrop-blur-md sm:items-center" class="fixed inset-0 z-30 flex items-end justify-center bg-black/50 pb-8 backdrop-blur-xs sm:items-center"
role="dialog" role="dialog"
aria-modal="true" aria-modal="true"
aria-label="Modal"> aria-label="Modal">

View File

@ -14,12 +14,16 @@
class="truncate text-blue-600 hover:text-blue-500" class="truncate text-blue-600 hover:text-blue-500"
>{{ $p.LinkTitle }}</a >{{ $p.LinkTitle }}</a
> >
{{ template "breadcrumbs-arrow" . }} {{ if ne $ $documentation }}
{{ template "breadcrumbs-arrow" . }}
{{ end }}
</li>
{{ end }}
{{ if ne $ $documentation }}
<li class="truncate text-gray-700 dark:text-gray-300">
{{ $.LinkTitle }}
</li> </li>
{{ end }} {{ end }}
<li class="truncate text-gray-700 dark:text-gray-300">
{{ $.LinkTitle | title }}
</li>
</ol> </ol>
</nav> </nav>

View File

@ -2,12 +2,12 @@
<a <a
href="{{ .html_url | safeURL }}" href="{{ .html_url | safeURL }}"
target="_blank" target="_blank"
class="font-normal tracking-tight flex items-center bg-gray-200 hover:bg-gray-300 dark:bg-gray-600 dark:hover:bg-gray-700 text-sm text-black dark:text-white h-10 border-none cursor-pointer relative py-1 px-2 rounded-md" class="font-normal font-mono tracking-tighter flex items-center bg-gray-100 hover:bg-gray-200 dark:bg-gray-600 dark:hover:bg-gray-700 text-sm text-black dark:text-white h-10 border-none cursor-pointer relative py-1 px-2 rounded-md"
aria-label="Star on GitHub"> aria-label="Star on GitHub">
<svg class="mr-1 fill-gray-800 dark:fill-gray-100 w-5 h-5"> <svg class="mr-[4px] fill-gray-800 dark:fill-gray-100 w-6 h-6">
<use href="#icon--github"></use> <use href="#icon--github"></use>
</svg> </svg>
<span class="hidden md:inline mr-1">Star</span> <span class="hidden md:inline mr-[3px]">Star</span>
<span class="hidden md:inline">{{ .stargazers_count }}</span> <span class="hidden md:inline">{{ .stargazers_count }}</span>
<span class="inline md:hidden"> <span class="inline md:hidden">
{{ printf "%0.1fk" (div .stargazers_count 1000) }} {{ printf "%0.1fk" (div .stargazers_count 1000) }}

View File

@ -1,7 +1,7 @@
<header <header
x-data="navbar" x-data="navbar"
class="sticky top-0 z-50 bg-blue-950 flex flex-none flex-wrap items-center justify-between px-4 py-5 shadow-md shadow-slate-900/5 transition duration-500 sm:px-6 lg:px-8 dark:shadow-none" class="sticky top-0 z-50 bg-blue-950 flex flex-none flex-wrap items-center justify-between px-4 py-5 shadow-md shadow-slate-900/5 transition duration-500 sm:px-6 lg:px-8 dark:shadow-none"
:class="atTop ? '': 'bg-blue-950/80'"> :class="$store.nav.scroll.atTop ? '': 'bg-blue-950/80'">
<div class="relative flex basis-0 items-cente mr-2 lg:mr-8"> <div class="relative flex basis-0 items-cente mr-2 lg:mr-8">
{{ with site.Home }} {{ with site.Home }}
<a <a
@ -36,7 +36,7 @@
{{/* Social. */}} {{/* Social. */}}
<div <div
class="hidden sm:block ml-8 h-6 fill-slate-400 group-hover:fill-slate-500 dark:group-hover:fill-slate-300"> class="hidden sm:block ml-2 sm:ml-6 h-6 fill-slate-400 group-hover:fill-slate-500 dark:group-hover:fill-slate-300">
{{ partial "layouts/header/githubstars.html" . }} {{ partial "layouts/header/githubstars.html" . }}
</div> </div>
</div> </div>

View File

@ -5,7 +5,8 @@
}} }}
{{ $qrBig := partial "partials/_inline/qr" (dict "page" $ "img_class" "w-64 p-4") }} {{ $qrBig := partial "partials/_inline/qr" (dict "page" $ "img_class" "w-64 p-4") }}
{{ $t.Stop }} {{ $t.Stop }}
<div class="hidden lg:block cursor-pointer"> <div
class="hidden lg:block cursor-pointer outline-2 hover:outline-3 outline-blue-500">
{{ partial "layouts/blocks/modal.html" (dict "modal_button" $qr "modal_content" $qrBig "modal_title" (printf "QR code linking to %s" $.Permalink )) }} {{ partial "layouts/blocks/modal.html" (dict "modal_button" $qr "modal_content" $qrBig "modal_title" (printf "QR code linking to %s" $.Permalink )) }}
</div> </div>

View File

@ -1,10 +1,10 @@
<div class="ml-4 sm:ml-10 flex items-center" x-data> <div class="ml-2 sm:ml-6 flex items-center" x-data>
<button <button
@click="$store.nav.userSettings.toggleColorScheme()" @click="$store.nav.userSettings.toggleColorScheme()"
aria-label="Toggle color scheme" aria-label="Toggle color scheme"
id="theme-toggle" id="theme-toggle"
type="button" type="button"
class="inline-flex items-center p-2 bg-accent hover:bg-accent/70 dark:bg-gray-600 dark:hover:bg-gray-700 border border-transparent rounded-full shadow-sm text-white hover:text-gray-200 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-slate-500"> class="inline-flex cursor-pointer items-center p-2 bg-orange-600 hover:bg-orange-700 dark:bg-gray-600 dark:hover:bg-gray-700 border border-transparent rounded-full shadow-sm text-white hover:text-gray-200 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-slate-500">
<svg <svg
aria-hidden="true" aria-hidden="true"
class="w-3 h-3 sm:w-5 sm:h-5" class="w-3 h-3 sm:w-5 sm:h-5"

View File

@ -1,15 +1,18 @@
{{- with .CurrentSection.RegularPages }} {{- with .CurrentSection.RegularPages }}
<h2 {{ $hasTocOrRelated := or ($.Store.Get "hasToc") ($.Store.Get "hasRelated") }}
class="text-base font-semibold tracking-tight text-gray-600 dark:text-gray-400">
{{ "In this section" | title }}
</h2>
<div <div
class="relative my-2 class="overflow-y-auto {{ if $hasTocOrRelated }}
after:absolute after:bottom-0 after:left-0 after:w-full after:h-8 after:bg-gradient-to-t after:from-white dark:after:from-blue-950"> max-h-96
<ul {{ else }}
id="in-sthis-section" sticky top-[8rem] max-h-[70vh]
class="max-h-96 pb-8 overflow-y-auto" {{ end }} relative mt-2 mb-8"
data-turbo-preserve-scroll-container="in-this-section"> data-turbo-preserve-scroll-container="in-this-section">
<h2
class="text-base font-semibold tracking-tight text-gray-600 dark:text-gray-400">
In this section
</h2>
<ul id="in-sthis-section" class="mt-2">
{{- range . }} {{- range . }}
<li> <li>
<a <a

View File

@ -1,6 +1,6 @@
<hr class="border-t border-gray-200 dark:border-gray-800 my-10 lg:my-16" /> <hr class="border-t border-gray-200 dark:border-gray-800 my-10 lg:my-16" />
<div class="text-gray-800 font-semibold"> <div class="text-gray-800 dark:text-gray-300 font-semibold">
Last updated: Last updated:
{{ .Lastmod.Format "January 2, 2006" }}{{ with .GitInfo }} {{ .Lastmod.Format "January 2, 2006" }}{{ with .GitInfo }}
: :

View File

@ -1,5 +1,5 @@
{{- $heading := "See also" | title }} {{- $heading := "See also" }}
{{- $related := site.RegularPages.Related . | first 5 }} {{- $related := slice }}
{{- if .Params.action.related }} {{- if .Params.action.related }}
{{- $related = slice }} {{- $related = slice }}
@ -12,13 +12,18 @@
{{- warnf "The 'related' partial was unable to get page %s" . }} {{- warnf "The 'related' partial was unable to get page %s" . }}
{{- end }} {{- end }}
{{- end }} {{- end }}
{{- else }}
{{- $related = site.RegularPages.Related . }}
{{- end }} {{- end }}
{{/* Avoid repeating pages that's listed in In this section. */}}
{{- $related = $related | complement .CurrentSection.RegularPages | first 7 }}
{{- with $related }} {{- with $related }}
{{ $.Store.Set "hasRelated" true }}
<h2 <h2
class="text-base font-semibold tracking-tight text-gray-600 dark:text-gray-400"> class="text-base font-semibold tracking-tight text-gray-600 dark:text-gray-400">
{{ $heading }} {{ $heading }}
</h2> </h2>
<ul class="mb-10 mt-2"> <ul class="mt-2 mb-8">
{{- range . }} {{- range . }}
<li> <li>
<a <a

View File

@ -0,0 +1,19 @@
<button
{{ if .standalone }}
x-data @click="$dispatch('search-toggle')"
{{ else }}
type="button" x-show="!open" x-transition.opacity.duration.500ms
{{ end }}
class="grid cursor-pointer w-full text-gray-500 sm:w-40 lg:w-56 grid-cols-[auto_1fr_auto] items-center gap-3 rounded-md px-4 py-2 text-left text-xs/6 lg:text-sm/6 outline-1 -outline-offset-1 outline-gray-600">
<svg
class="pointer-events-none -ml-0.5 size-4 fill-slate-400 dark:fill-slate-500">
<use href="#icon--search"></use>
</svg>
Search docs<kbd
class="hidden font-sans text-xs/4 text-gray-400 dark:text-gray-400 [.os-macos_&amp;]:block"
><span class="text-gray-400/70"></span>K</kbd
><kbd
class="hidden font-sans text-xs/4 text-gray-400 not-[.os-macos_&amp;]:block dark:text-gray-400"
><span class="text-gray-400/70">Ctrl</span>&nbsp;K</kbd
>
</button>

View File

@ -1,12 +0,0 @@
<div
class="group relative flex h-12"
x-data
@click="$dispatch('search-toggle')">
<svg
class="pointer-events-none sm:absolute left-4 top-0 h-full w-5 fill-slate-400 dark:fill-slate-500">
<use href="#icon--search"></use>
</svg>
<input
class="flex-auto hidden sm:block appearance-none bg-transparent pl-12 text-slate-900 outline-none placeholder:text-slate-400 focus:w-full focus:flex-none sm:text-sm dark:text-white [&::-webkit-search-cancel-button]:hidden [&::-webkit-search-decoration]:hidden [&::-webkit-search-results-button]:hidden [&::-webkit-search-results-decoration]:hidden"
placeholder="Search the Docs..." />
</div>

View File

@ -1,15 +1,4 @@
<div x-data="search"> <div x-data="search" class="flex w-full">
<div {{ partial "layouts/search/button.html" (dict "page" . "standalone" false) }}
class="group relative flex h-12"
x-show="!open"
x-transition.opacity.duration.500ms>
<svg
class="pointer-events-none lg:absolute left-4 top-0 h-full w-5 fill-slate-400 dark:fill-slate-500">
<use href="#icon--search"></use>
</svg>
<input
class="hidden lg:block flex-auto appearance-none bg-transparent pl-12 text-slate-900 outline-none placeholder:text-slate-200 focus:w-full focus:flex-none sm:text-sm dark:text-white [&::-webkit-search-cancel-button]:hidden [&::-webkit-search-decoration]:hidden [&::-webkit-search-results-button]:hidden [&::-webkit-search-results-decoration]:hidden"
placeholder="Search the Docs..." />
</div>
{{ partial "layouts/search/results.html" . }} {{ partial "layouts/search/results.html" . }}
</div> </div>

View File

@ -1,7 +1,7 @@
<div <div
class="fixed inset-0 overflow-hidden z-20" class="fixed inset-0 overflow-hidden z-20"
:class="{'fixed': open}" :class="{'fixed': open}"
aria-label="Search the Docs" aria-label="Search docs"
role="dialog" role="dialog"
aria-modal="true" aria-modal="true"
@keydown.right="$focus.next()" @keydown.right="$focus.next()"
@ -32,7 +32,7 @@
@click="search()" @click="search()"
type="search" type="search"
class="text-gray-800 dark:text-gray-100 bg-white/40 dark:bg-gray-900 shadow rounded border-0 p-3 w-full" class="text-gray-800 dark:text-gray-100 bg-white/40 dark:bg-gray-900 shadow rounded border-0 p-3 w-full"
placeholder="Search the Docs..." placeholder="Search docs"
x-ref="input" /> x-ref="input" />
</div> </div>
</div> </div>

View File

@ -1,10 +1,11 @@
{{ with .Fragments.Headings }} {{ with .Fragments.Headings }}
{{ $.Store.Set "hasToc" true }}
<div <div
x-data="toc" x-data="toc"
class="sticky top-[8rem] h-screen overflow-y-auto overflow-x-hidden"> class="sticky top-[8rem] h-screen overflow-y-auto overflow-x-hidden">
<h2 <h2
class="text-base font-semibold tracking-tight text-gray-600 dark:text-gray-400"> class="text-base font-semibold tracking-tight text-gray-600 dark:text-gray-400">
{{ "On this page" | title }} On this page
</h2> </h2>
<nav class="w-56 mt-2"> <nav class="w-56 mt-2">
<ul> <ul>

View File

@ -60,41 +60,50 @@
{{- else }} {{- else }}
{{- $code = $.Inner }} {{- $code = $.Inner }}
{{- end }} {{- end }}
{{ $langs := (slice "yaml" "toml" "json") }} <div x-data class="shortcode-code not-prose relative p-0 mt-2 mb-4 sm:mb-8">
<div <svg
x-data class="absolute right-2 top-0 z-30 text-blue-600 hover:text-blue-500 cursor-pointer w-8"
class="shortcode-code not-prose relative border-1 border-gray-300 dark:border-gray-900 p-0 my-2 sm:my-6 min-h-30"> @click="$copy($refs[$store.nav.userSettings.settings.configFileType])">
<div> <use href="#icon--copy"></use>
<svg </svg>
class="absolute right-0 top-2 pr-3 z-30 text-blue-600 hover:text-blue-500 cursor-pointer w-10" <nav class="relative flex" aria-label="Tabs">
@click="$copy($refs[$store.nav.userSettings.settings.configFileType])"> {{ with $file }}
<use href="#icon--copy"></use> <div
</svg> class="flex-none text-sm px-2 content-center border-b-1 border-gray-300 dark:border-gray-700"
<nav class="relative flex" aria-label="Tabs"> aria-lbabel="Filename">
{{ range $i, $lang := $langs }} {{ . }}{{ if not $fm }}.{{ end }}
<button </div>
x-on:click="$store.nav.userSettings.settings.configFileType = '{{ index $langs $i }}'"
aria-label="{{ printf `Toggle %s` . }}"
class="p-3 text-white font-semibold dark:text-gray-300 hover:text-gray-100 dark:hover:text-gray-100 bg-blue-500 dark:bg-blue-900 hover:bg-blue-300 dark:hover:bg-slate-700 cursor-pointer relative min-w-0 flex-1 overflow-hidden text-sm no-underline text-center focus:z-10 overflow-x-auto">
<span>
{{ printf "%s.%s" $file . }}
</span>
<span
aria-hidden="true"
class="absolute inset-x-0 bottom-0 h-0.75"
:class="$store.nav.userSettings.settings.configFileType === '{{ index $langs $i }}' ? 'bg-accent dark:bg-accent-dark' : 'bg-transparent'"></span>
</button>
{{ end }}
</nav>
{{ if $code }}
{{ range $i, $lang := $langs }}
<div
class="max-h-96 overflow-y-auto"
x-ref="{{ $lang }}"
:class="$store.nav.userSettings.settings.configFileType === '{{ index $langs $i }}' ? 'block' : 'hidden'">
{{ highlight ($code | transform.Remarshal . | safeHTML) . "" }}
</div>
{{ end }}
{{ end }} {{ end }}
</div> {{ range $i, $lang := $langs }}
{{ $isLast := eq (add $i 1) (len $langs) }}
<button
x-on:click="$store.nav.userSettings.settings.configFileType = '{{ index $langs $i }}'"
aria-label="{{ printf `Toggle %s` . }}"
class="px-3 py-2 font-semibold text-black dark:text-slate-200 border-l-1 border-t-1 {{ if $isLast }}
border-r-1
{{ end }} border-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 dark:border-gray-700 cursor-pointer relative min-w-0 flex-1 overflow-hidden text-sm no-underline text-center focus:z-10 overflow-x-auto"
:class="$store.nav.userSettings.settings.configFileType === '{{ index $langs $i }}' ? 'border-b-0 bg-light dark:bg-dark' : 'border-b-1'">
<span>
{{ . }}
</span>
</button>
{{ end }}
</nav>
{{ if $code }}
{{ range $i, $lang := $langs }}
<div
class="max-h-96 overflow-y-auto border-l-1 border-b-1 border-r-1 border-gray-300 dark:border-gray-700"
x-ref="{{ $lang }}"
x-cloak
x-transition:enter.opacity.duration.300ms
x-show="$store.nav.userSettings.settings.configFileType === '{{ index $langs $i }}'">
{{- $hCode := $code | transform.Remarshal . }}
{{- if and $fm (in (slice "toml" "yaml") .) }}
{{- $hCode = printf "%s\n%s\n%s" $placeHolder $hCode $placeHolder }}
{{- end }}
{{- $hCode = $hCode | replaceRE `\n+` "\n" }}
{{ highlight $hCode . "" | replaceRE $placeHolder (index $delimiters .) | safeHTML }}
</div>
{{ end }}
{{ end }}
</div> </div>

View File

@ -1,20 +1,26 @@
{{ $codeLang := "go-html-template" }} {{- $codeLang := or (.Get "lang") "" }}
<div <div
x-data x-data
class="shortcode-code font-mono not-prose relative bg-gray-200 dark:bg-blue-900 text-gray-500 p-[1px] dark:text-gray-400 mt-6 mb-8"> class="shortcode-code font-mono not-prose relative mt-6 mb-8 border-1 border-gray-200 bg-light">
{{- with .Get "file" -}} {{ if (.Get "copy") }}
<div class="san-serif text-sm inline-block leading-none pl-2 py-3">
{{ . }}
</div>
{{- end -}}
{{ if ne (.Get "copy") "false" }}
<svg <svg
class="absolute right-0 top-2 pr-3 z-30 text-blue-600 hover:text-blue-500 cursor-pointer w-10" class="absolute right-2 top-2 z-30 text-blue-600 hover:text-blue-500 cursor-pointer w-6 h-6"
@click="$copy($refs.code)"> @click="$copy($refs.code)">
<use href="#icon--copy"></use> <use href="#icon--copy"></use>
</svg> </svg>
{{ end }} {{ end }}
{{- with .Get "file" -}}
{{- if not $codeLang }}
{{- $ext := strings.TrimPrefix "." (path.Ext .) }}
{{- $codeLang = cond (eq $ext "html") "go-html-template" $ext }}
{{- end }}
<div
class="san-serif text-sm inline-block leading-none pl-2 py-3 bg-gray-100 w-full">
{{ . }}
</div>
{{- end -}}
<div class="" x-ref="code"> <div class="" x-ref="code">
{{ $inner := trim .Inner "\n" | safeHTML }} {{ $inner := trim .Inner "\n" | safeHTML }}
{{ if .Get "nocode" }} {{ if .Get "nocode" }}
@ -23,7 +29,8 @@
{{ with $codeLang }} {{ with $codeLang }}
{{ highlight $inner . "" }} {{ highlight $inner . "" }}
{{ else }} {{ else }}
<pre><code>{{ $inner }}</code></pre> <pre class="overflow-x-auto p-2 w-[93%]"><code>{{ $inner }}</code>
</pre>
{{ end }} {{ end }}
{{ end }} {{ end }}
</div> </div>

View File

@ -1,23 +1,22 @@
{{- /* {{- /*
Renders a "new in" button indicating the version in which a feature was added. Renders a "new in" button indicating the version in which a feature was added.
When comparing the current version to the specified version, the "new in" When comparing the current version to the specified version, the "new in"
button will be hidden if any of the following conditions is true: button will be hidden if any of the following conditions is true:
- The major version difference exceeds the majorVersionDiffThreshold - The major version difference exceeds the majorVersionDiffThreshold
- The minor version difference exceeds the minorVersionDiffThreshold - The minor version difference exceeds the minorVersionDiffThreshold
@param {string} version The semantic version string, with or without a leading v. @param {string} version The semantic version string, with or without a leading v.
@returns {template.HTML} @returns {template.HTML}
@examples {{< new-in 0.100.0 />}} @examples {{< new-in 0.100.0 /
>}}
{{< new-in 0.100.0 >}} {{< new-in 0.100.0 >}}
Some descriptive text here. Some descriptive text here.
{{< /new-in >}} {{< /new-in >}}
*/}} */}}
{{ $_hugo_config := `{ "version": 1 }` }} {{ $_hugo_config := `{ "version": 1 }` }}
{{- /* Set defaults. */}} {{- /* Set defaults. */}}
@ -36,14 +35,30 @@ button will be hidden if any of the following conditions is true:
{{- else }} {{- else }}
{{- $href := printf "https://github.com/gohugoio/hugo/releases/tag/v%s" $version }} {{- $href := printf "https://github.com/gohugoio/hugo/releases/tag/v%s" $version }}
{{- with $.Inner }} {{- with $.Inner }}
<aside> {{ $text := printf `<p class="fon-semibold">New in <a href=%q>v%s</a>.</p>%s`
<div class="admonition-content bl bw2 b--blue" > $href $version (. | $.Page.RenderString (dict "display" "block"))
<p>New in <a href="{{ $href }}">v{{ $version }}</a>.</p> }}
{{ . | $.Page.RenderString (dict "display" "block") }}
</div> {{ partial "layouts/blocks/alert.html" (dict
</aside> "text" ($text | safeHTML)
"color" "green"
"icon" "exclamation"
)
}}
{{- else }} {{- else }}
<a class="dib f5 fw6 ba bw1 b--gray ph2 mt1" href="{{ $href }}">New in v{{ $version }}</a> <span
class="not-prose inline-flex items-center px-2 mr-1 rounded text-sm font-medium bg-green-200 dark:bg-green-400 fill-green-600">
<svg class="mr-1.5 h-2 w-2" viewBox="0 0 8 8">
<circle cx="4" cy="4" r="3" />
</svg>
<a
class="text-green-800 dark:text-black hover:text-green-600 no-underline"
href="{{ $href }}"
target="_blank">
New in
v{{ $version }}
</a>
</span>
{{- end }} {{- end }}
{{- end }} {{- end }}
{{- else }} {{- else }}

View File

@ -16,7 +16,7 @@
HUGO_ENV = "production" HUGO_ENV = "production"
[context.deploy-preview] [context.deploy-preview]
command = "hugo --gc --minify --buildFuture -b $DEPLOY_PRIME_URL" command = "hugo --gc --minify --buildFuture -b $DEPLOY_PRIME_URL --enableGitInfo"
[context.branch-deploy] [context.branch-deploy]
command = "hugo --gc --minify -b $DEPLOY_PRIME_URL" command = "hugo --gc --minify -b $DEPLOY_PRIME_URL"