diff --git a/.codespellrc b/.codespellrc index 00b34a498..564fc77c0 100644 --- a/.codespellrc +++ b/.codespellrc @@ -4,7 +4,7 @@ [codespell] # 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. ignore-words-list = abl,edn,te,ue,trys,januar,womens,crossreferences diff --git a/assets/css/components/content.css b/assets/css/components/content.css index 6ad1c6bc6..fc11e357b 100644 --- a/assets/css/components/content.css +++ b/assets/css/components/content.css @@ -11,10 +11,14 @@ @apply text-gray-400; } +.highlight code { + @apply text-sm; +} + .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 */ - @apply prose-h6:font-bold; + @apply prose-h4:font-bold prose-h5:font-bold prose-h6:font-bold; /* 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; /* links */ @@ -23,12 +27,16 @@ /* 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; /* 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; /* 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; /* hr */ @apply dark:prose-hr:border-slate-800; + + h6 + * { + @apply mt-2; + } } /* This will not match highlighting inside e.g. the code-toggle shortcode. */ diff --git a/assets/js/alpinejs/data/explorer.js b/assets/js/alpinejs/data/explorer.js index b1496d35d..4be8fb104 100644 --- a/assets/js/alpinejs/data/explorer.js +++ b/assets/js/alpinejs/data/explorer.js @@ -12,7 +12,7 @@ export const explorer = (Alpine) => ({ // The state of each node in the tree. 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 array is sorted by length, so we can find the longest prefix of the current page // without having to iterate over all the keys. diff --git a/assets/js/alpinejs/data/navbar.js b/assets/js/alpinejs/data/navbar.js index ec1ce73fa..d2b119f0c 100644 --- a/assets/js/alpinejs/data/navbar.js +++ b/assets/js/alpinejs/data/navbar.js @@ -1,12 +1,10 @@ export const navbar = (Alpine) => ({ - atTop: true, - init: function () { Alpine.bind(this.$root, this.root); }, root: { ['@scroll.window.debounce.10ms'](event) { - this.atTop = window.scrollY < 40 ? true : false; + this.$store.nav.scroll.atTop = window.scrollY < 40 ? true : false; }, }, }); diff --git a/assets/js/alpinejs/data/toc.js b/assets/js/alpinejs/data/toc.js index e0818fa98..3da9f7eac 100644 --- a/assets/js/alpinejs/data/toc.js +++ b/assets/js/alpinejs/data/toc.js @@ -16,6 +16,12 @@ export const toc = (Alpine) => ({ }, init() { + this.$watch('$store.nav.scroll.atTop', (value) => { + if (!value) return; + this.activeHeading = ''; + this.$root.scrollTop = 0; + }); + return this.$nextTick(() => { let contentEl = document.getElementById('content'); if (contentEl) { diff --git a/assets/js/alpinejs/magics/helpers.js b/assets/js/alpinejs/magics/helpers.js index f7046259d..de9fa24e9 100644 --- a/assets/js/alpinejs/magics/helpers.js +++ b/assets/js/alpinejs/magics/helpers.js @@ -6,10 +6,17 @@ export function registerMagics(Alpine) { if (!el) { el = currentEl; } - let lntds = el.querySelectorAll('.lntable .lntd'); - if (lntds && lntds.length === 2) { - el = lntds[1]; - } + + // Select the element to copy. + 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. let text = el.textContent.trim(); diff --git a/assets/js/alpinejs/stores/nav.js b/assets/js/alpinejs/stores/nav.js index 7e67d85ce..c5620cf7c 100644 --- a/assets/js/alpinejs/stores/nav.js +++ b/assets/js/alpinejs/stores/nav.js @@ -27,6 +27,10 @@ export const navStore = (Alpine) => ({ destroy() {}, + scroll: { + atTop: true, + }, + userSettings: { // settings gets persisted between page navigations. settings: Alpine.$persist({ diff --git a/assets/js/head-early.js b/assets/js/head-early.js index ca86b5694..250bdd6cb 100644 --- a/assets/js/head-early.js +++ b/assets/js/head-early.js @@ -4,6 +4,11 @@ import { scrollToActive } from 'js/helpers/index'; // Now we know that the browser has JS enabled. 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. document.addEventListener('DOMContentLoaded', function () { scrollToActive('DOMContentLoaded'); diff --git a/content/en/about/_index.md b/content/en/about/_index.md index 9ff1c34ec..fb526c509 100644 --- a/content/en/about/_index.md +++ b/content/en/about/_index.md @@ -1,6 +1,6 @@ --- title: About Hugo - +linktitle: About description: Learn about Hugo and its features, security model, and privacy protections. categories: [] keywords: [] diff --git a/content/en/contribute/_index.md b/content/en/contribute/_index.md index be8ca330e..5573b6427 100644 --- a/content/en/contribute/_index.md +++ b/content/en/contribute/_index.md @@ -1,6 +1,6 @@ --- title: Contribute to the Hugo project - +linktitle: Contribute description: Contribute to Hugo development, documentation, and themes. categories: [] keywords: [] diff --git a/content/en/documentation.md b/content/en/documentation.md index 2dc5a12e5..11f843f91 100644 --- a/content/en/documentation.md +++ b/content/en/documentation.md @@ -1,6 +1,6 @@ --- 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. menu: main: diff --git a/content/en/getting-started/external-learning-resources/index.md b/content/en/getting-started/external-learning-resources/index.md index 46c66a737..80805d4a6 100644 --- a/content/en/getting-started/external-learning-resources/index.md +++ b/content/en/getting-started/external-learning-resources/index.md @@ -1,5 +1,6 @@ --- title: External learning resources +linkTitle: External resources description: Use these third-party resources to learn Hugo. categories: [getting started] keywords: [books, tutorials, learning, usage] diff --git a/content/en/quick-reference/_index.md b/content/en/quick-reference/_index.md index 3e5c6fcb9..f2673ba37 100644 --- a/content/en/quick-reference/_index.md +++ b/content/en/quick-reference/_index.md @@ -1,6 +1,6 @@ --- title: Quick reference guides - +linktitle: Quick reference description: Use these quick reference guides for quick access to key information. categories: [] keywords: [] diff --git a/data/sponsors.toml b/data/sponsors.toml new file mode 100644 index 000000000..705ca9746 --- /dev/null +++ b/data/sponsors.toml @@ -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'" diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index f8258b33b..f6e281455 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -14,7 +14,7 @@
+ 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 "rightsidebar" . }} diff --git a/layouts/_default/list.html b/layouts/_default/list.html index bccedb778..0035716ef 100644 --- a/layouts/_default/list.html +++ b/layouts/_default/list.html @@ -2,7 +2,7 @@ {{ $pages := "" }} {{ $showDate := false }} {{ 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 }} {{ else }} {{ if eq .Section "news" }} diff --git a/layouts/_default/single.html b/layouts/_default/single.html index ec21aa85c..ff6aa3787 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -11,34 +11,38 @@ {{ $t := debug.Timer "single.categories" }} {{ $tags := .GetTerms "categories" }} - {{ range $tags }} - {{ $text := .LinkTitle }} - {{ $class := "" }} - {{ range (slice true false ) }} - {{ $color := partial "helpers/funcs/color-from-string.html" (dict "text" $text "dark" . ) }} + {{ with $tags }} +
+ {{ range . }} + {{ $text := .LinkTitle }} + {{ $class := "" }} + {{ range (slice true false ) }} + {{ $color := partial "helpers/funcs/color-from-string.html" (dict "text" $text "dark" . "--single" "green" ) }} - {{ $prefix := "" }} - {{ if . }} - {{ $prefix = "dark:" }} + {{ $prefix := "" }} + {{ if . }} + {{ $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 }} + + + + {{ .LinkTitle }} + {{ 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.shade2 - }} - {{ end }} - - - - {{ .LinkTitle | upper }} - +
{{ end }} {{ $t.Stop }} {{ if .Params.action.signatures }} -
+
{{- partial "docs/functions-signatures.html" . -}} {{- partial "docs/functions-return-type.html" . -}} {{- partial "docs/functions-aliases.html" . -}} @@ -56,9 +60,12 @@ {{ end }} {{ 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 }} {{ partial "layouts/in-this-section.html" . }} {{ end }} - {{ partial "layouts/related.html" . }} - {{ partial "layouts/toc.html" . }} + {{ $related }} + {{ $toc }} {{ end }} diff --git a/layouts/index.html b/layouts/index.html index d969c86db..50dc2fbf3 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -35,7 +35,7 @@ > {{ end }}
- {{ partial "layouts/search/input-standalone.html" . }} + {{ partial "layouts/search/button.html" (dict "page" . "standalone" true) }}
diff --git a/layouts/partials/docs/functions-aliases.html b/layouts/partials/docs/functions-aliases.html index c1c4090e9..dc562307a 100644 --- a/layouts/partials/docs/functions-aliases.html +++ b/layouts/partials/docs/functions-aliases.html @@ -5,7 +5,7 @@ {{- end }}

{{ $label }}

{{- range . }} -
+
{{- . -}}
{{- end }} diff --git a/layouts/partials/docs/functions-return-type.html b/layouts/partials/docs/functions-return-type.html index 6b56a1806..13c8c96f4 100644 --- a/layouts/partials/docs/functions-return-type.html +++ b/layouts/partials/docs/functions-return-type.html @@ -1,6 +1,6 @@ {{- with .Params.action.returnType }}

Returns

-
+
{{- . -}}
{{- end -}} diff --git a/layouts/partials/docs/functions-signatures.html b/layouts/partials/docs/functions-signatures.html index 5cabdfba0..35d950265 100644 --- a/layouts/partials/docs/functions-signatures.html +++ b/layouts/partials/docs/functions-signatures.html @@ -5,7 +5,7 @@ {{- if $.Params.function.returnType }} {{- $signature = printf "%s ⟼ %s" . $.Params.function.returnType }} {{- end }} -
+
{{- $signature -}}
{{- end }} diff --git a/layouts/partials/helpers/funcs/color-from-string.html b/layouts/partials/helpers/funcs/color-from-string.html index cfb54b0be..cd599530b 100644 --- a/layouts/partials/helpers/funcs/color-from-string.html +++ b/layouts/partials/helpers/funcs/color-from-string.html @@ -1,7 +1,11 @@ -{{ $colors := slice "blue" "orange" "green" "pink" }} -{{ $shades := slice 200 300 500 }} -{{ if .dark }} - {{ $shades = slice 700 800 900 }} +{{ $colors := slice "slate" "green" "cyan" "blue" }} +{{ with .single }} + {{ $colors = slice . }} +{{ end }} + +{{ $shades := slice 300 400 500 }} +{{ if not .dark }} + {{ $shades = slice 700 800 }} {{ end }} {{ $hash := (hash.FNV32a .text) }} {{ $i := mod $hash (len $colors) }} @@ -9,10 +13,13 @@ {{ $color := index $colors $i }} {{ $shade1 := index $shades $j }} {{ $shade2 := 0 }} -{{ if gt $shade1 400 }} - {{ $shade2 = math.Min (sub $shade1 400) 100 | int }} +{{ $shade3 := 0 }} +{{ if gt $shade1 500 }} + {{ $shade2 = math.Min (sub $shade1 500) 100 | int }} + {{ $shade3 = sub $shade1 100 }} {{ else }} - {{ $shade2 = math.Max (add $shade1 400) 800 | int }} + {{ $shade2 = math.Max (add $shade1 500) 700 | int }} + {{ $shade3 = add $shade1 200 }} {{ end }} -{{ $res := dict "color" $color "shade1" $shade1 "shade2" $shade2 }} +{{ $res := dict "color" $color "shade1" $shade1 "shade2" $shade2 "shade3" $shade3 }} {{ return $res }} diff --git a/layouts/partials/layouts/blocks/alert.html b/layouts/partials/layouts/blocks/alert.html index 4db3cbd24..705ce0e7e 100644 --- a/layouts/partials/layouts/blocks/alert.html +++ b/layouts/partials/layouts/blocks/alert.html @@ -13,11 +13,11 @@
{{ with $title }} -

+

{{ . }}

{{ end }} -
+

{{ $text }}

diff --git a/layouts/partials/layouts/blocks/modal.html b/layouts/partials/layouts/blocks/modal.html index 2ae145cc7..7d825c06e 100644 --- a/layouts/partials/layouts/blocks/modal.html +++ b/layouts/partials/layouts/blocks/modal.html @@ -5,11 +5,12 @@