]> git.maquefel.me Git - brevno-suite/hugo/commitdiff
Squashed 'docs/' changes from 5c085a37b..a9584e3d1
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Wed, 7 Feb 2024 19:46:41 +0000 (20:46 +0100)
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Wed, 7 Feb 2024 19:46:41 +0000 (20:46 +0100)
a9584e3d1 ci: bump GitHub workflow actions to latest versions
f37ee374d Fix methods related to time.After
a49214057 Correct heading render hook example
4b696f936 Update README.md
b5a6e4039 Clean up the contributing section
a5d79ed19 Fixed typo: instea → instead
6150a60e3 Remove the "local file templates" page
9395743dc Update/vendor theme
33d8c10cc Remove output format "name" parameter
7200ad97d Add security section to resources.GetRemote page
3f1e056b2 Remove erroneous front matter field
07c9a7e42 Add alpha index to glossary
6619c8aa0 Fix Page.Params example
145a92359 Simplify string concat example in math.Add
42488bb09 Add string concat example to math.Add
eb20521a2 Fix flash of unstyled content with mathematical markup
74603bebe Fix typo in 'typesetting'

git-subtree-dir: docs
git-subtree-split: a9584e3d146c4a194d937a4dc8a37cde5ba1c618

29 files changed:
.cspell.json
.github/workflows/codeql-analysis.yml
.github/workflows/super-linter.yml
README.md
_vendor/github.com/gohugoio/gohugoioTheme/layouts/_default/baseof.html
_vendor/github.com/gohugoio/gohugoioTheme/layouts/partials/components/author-github-data-card.html
_vendor/github.com/gohugoio/gohugoioTheme/layouts/partials/components/author-github-data.html
_vendor/github.com/gohugoio/gohugoioTheme/layouts/partials/maintenance-pages-table.html
_vendor/github.com/gohugoio/gohugoioTheme/layouts/partials/math.html
_vendor/github.com/gohugoio/gohugoioTheme/layouts/partials/page-edit.html
_vendor/modules.txt
content/en/content-management/front-matter.md
content/en/content-management/mathematics.md
content/en/contribute/development.md
content/en/contribute/documentation.md
content/en/functions/math/Add.md
content/en/functions/os/ReadDir.md
content/en/functions/os/ReadFile.md
content/en/functions/resources/GetRemote.md
content/en/getting-started/glossary.md
content/en/methods/page/Params.md
content/en/methods/time/After.md
content/en/templates/files.md [deleted file]
content/en/templates/output-formats.md
content/en/templates/render-hooks.md
go.mod
go.sum
layouts/_default/baseof.html [new file with mode: 0644]
layouts/partials/math.html [new file with mode: 0644]

index b8ea0610f891b822195e10b84fa56b6a8db71423..de66ff601c2e46f5e8086d34b2293035b862bd7d 100644 (file)
     "doas",
     "eopkg",
     "gitee",
+    "gohugoio",
     "goldmark",
     "KaTeX",
     "kubuntu",
index 48555823e86f4373fb06d36ed544696c35b4743f..86441b84521897ce82a299e5dbe34d50f821346a 100644 (file)
@@ -18,9 +18,9 @@ jobs:
         uses: actions/checkout@v4
 
       - name: Initialize CodeQL
-        uses: github/codeql-action/init@v2
+        uses: github/codeql-action/init@v3
         with:
           languages: "javascript"
 
       - name: Perform CodeQL Analysis
-        uses: github/codeql-action/analyze@v2
+        uses: github/codeql-action/analyze@v3
index b2a5cb6f1c763c2c9e2c4ceeabe477168ee4ea68..d8e408ee2fcf15204a782171ca64318decb4c121 100644 (file)
@@ -21,7 +21,7 @@ jobs:
         uses: actions/checkout@v4
 
       - name: Lint Code Base
-        uses: super-linter/super-linter/slim@v5
+        uses: super-linter/super-linter/slim@v6
         env:
           DEFAULT_BRANCH: master
           GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
index bf5d9402c196f2c7d1421919c83c4edbdd307f61..93eaaf02ec2546d86d9f4bd8da7e3ba8b692f234 100644 (file)
--- a/README.md
+++ b/README.md
@@ -1,56 +1,20 @@
-[![Netlify Status](https://api.netlify.com/api/v1/badges/e0dbbfc7-34f1-4393-a679-c16e80162705/deploy-status)](https://app.netlify.com/sites/gohugoio/deploys)
-[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](https://gohugo.io/contribute/documentation/)
-
-# Hugo Docs
-
-Documentation site for [Hugo](https://github.com/gohugoio/hugo), the very fast and flexible static site generator built with love in Go.
-
-## Contributing
-
-We welcome contributions to Hugo of any kind including documentation, suggestions, bug reports, pull requests etc. Also check out our [contribution guide](https://gohugo.io/contribute/documentation/). We would love to hear from you.
-
-Note that this repository contains solely the documentation for Hugo. For contributions that aren't documentation-related please refer to the [hugo](https://github.com/gohugoio/hugo) repository.
-
-*Pull requests shall **only** contain changes to the actual documentation. However, changes on the codebase of Hugo **and** the documentation shall be a single, atomic pull request in the [hugo](https://github.com/gohugoio/hugo) repository.*
+<a href="https://gohugo.io/"><img src="https://raw.githubusercontent.com/gohugoio/gohugoioTheme/master/static/images/hugo-logo-wide.svg?sanitize=true" alt="Hugo" width="565"></a>
 
-Spelling fixes are most welcomed, and if you want to contribute longer sections to the documentation, it would be great if you had the following criteria in mind when writing:
+A fast and flexible static site generator built with love by [bep], [spf13], and [friends] in [Go].
 
-* Short is good. People go to the library to read novels. If there is more than one way to _do a thing_ in Hugo, describe the current _best practice_ (avoid "… but you can also do …" and "… in older versions of Hugo you had to …".
-* For example, try to find short snippets that teaches people about the concept. If the example is also useful as-is (copy and paste), then great. Don't list long and similar examples just so people can use them on their sites.
-* Hugo has users from all over the world, so easy to understand and [simple English](https://simple.wikipedia.org/wiki/Basic_English) is good.
+---
 
-## Edit the theme
-
-If you want to do docs-related theme changes, the simplest way is to have both `hugoDocs` and `gohugoioTheme` cloned as sibling directories, and then run:
-
-```sh
-HUGO_MODULE_WORKSPACE=hugo.work hugo server --ignoreVendorPaths "**"
-```
-
-## Branches
-
-* The `master` branch is where the site is automatically built from, and is the place to put changes relevant to the current Hugo version.
-* The `next` branch is where we store changes that are related to the next Hugo release. This can be previewed here: https://next--gohugoio.netlify.com/
-
-## Build
-
-To view the documentation site locally, you need to clone this repository:
+[![Netlify Status](https://api.netlify.com/api/v1/badges/e0dbbfc7-34f1-4393-a679-c16e80162705/deploy-status)](https://app.netlify.com/sites/gohugoio/deploys)
+[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](https://gohugo.io/contribute/documentation/)
 
-```sh
-git clone https://github.com/gohugoio/hugoDocs.git
-```
+This is the repository for the [Hugo](https://github.com/gohugoio/hugo) documentation site. 
 
-Also note that the documentation version for a given version of Hugo can also be found in the `/docs` sub-folder of the [Hugo source repository](https://github.com/gohugoio/hugo).
+Please see the [contributing] section for guidelines, examples, and process.
 
-Then to view the docs in your browser, run Hugo and open up the link:
 
-```sh
-▶ hugo server
 
-Started building sites ...
-.
-.
-Serving pages from memory
-Web Server is available at http://localhost:1313/ (bind address 127.0.0.1)
-Press Ctrl+C to stop
-```
+[bep]: https://github.com/bep
+[spf13]: https://github.com/spf13
+[friends]: https://github.com/gohugoio/hugo/graphs/contributors
+[go]: https://go.dev/
+[contributing]: https://gohugo.io/contribute/documentation
index 63b5b10f5b006fba67ea73a5fb9429c1e15791a5..beb2d8619b1e8ddaf1f822d5c4515b3a55ae3048 100644 (file)
@@ -1,4 +1,4 @@
-<!DOCTYPE html>
+<!doctype html>
 <html
   class="no-js"
   lang="{{ with $.Site.LanguageCode }}
@@ -98,7 +98,8 @@
       {{ partial "gtag.html" . }}
     {{ end }}
 
-    {{ if .Param "math" }}
+    {{ $hasMath := .Param "math" }}
+    {{ if $hasMath }}
       {{ partialCached "math.html" . }}
     {{ end }}
 
   <body
     class="ma0 sans-serif bg-primary-color-light{{ with getenv "HUGO_ENV" }}
       {{ . }}
-    {{ end }}">
+    {{ end }} {{ if $hasMath }}{{ print " dn" }}{{ end }}">
     {{ partial "hooks/after-body-start.html" . }}
     {{ block "nav" . }}{{ partial "site-nav.html" . }}{{ end }}
     {{ block "header" . }}{{ end }}
index 622df79532a7f15aa89c6164d6c535d905e17bd7..4caa21f3e2dfce34541b0a87cea8ae38e2c6a315 100644 (file)
@@ -1,32 +1,42 @@
 {{ $author := .context.Params.author }}
 {{ if $author }}
   <aside class="mw5 center bg-white br3 pa3 pa4-ns mv3 ba b--black-10 nested-links">
-    {{ $urlPre := "https://api.github.com" }}
-    {{ $user_json := getJSON $urlPre "/users/" $author }}
 
-    <div class="tc">
-
-      {{ if $user_json.avatar_url }}
-        <a href="{{ $user_json.html_url }}" class="link  hover-bg-light-gray pa1 br-100">
-          <img src="{{ $user_json.avatar_url }}&size={{ .size }}" alt="" class="br-100 ba b--light-gray">
-        </a>
+    {{ $data := "" }}
+    {{ $url := urls.JoinPath "https://api.github.com/users" $author }}
+    {{ with resources.GetRemote $url }}
+      {{ with .Err }}
+        {{ errorf "%s" . }}
+      {{ else }}
+        {{ $data = . | transform.Unmarshal }}
       {{ end }}
+    {{ else }}
+      {{ errorf "Unable to get remote resource %q" $url }}
+    {{ end }}
+
+    <div class="tc">
+      {{ with $data }}
 
-      {{ if $user_json.name }}
-        <h3 class="f4">
-          <a href="{{ $user_json.html_url }}" class="link dim">
-            {{ $user_json.name }}
+        {{ with .avatar_url }}
+          <a href="{{ . }}" class="link  hover-bg-light-gray pa1 br-100">
+            <img src="{{ . }}&size={{ $.size }}" alt="" class="br-100 ba b--light-gray">
           </a>
-        </h3>
-        <hr class="mw3 bb bw1 b--black-10">
-      {{ end }}
+        {{ end }}
+        {{ with .name  }}
+          <h3 class="f4">
+            <a href="{{ $data.html_url }}" class="link dim">
+              {{ . | htmlEscape }}
+            </a>
+          </h3>
+          <hr class="mw3 bb bw1 b--black-10">
+        {{ end }}
+        {{ with .bio }}
+          <p class="lh-copy measure center f6 black-70">
+            {{ . | htmlEscape }}
+          </p>
+        {{ end }}
 
-      {{ if $user_json.bio }}
-        <p class="lh-copy measure center f6 black-70">
-          {{ $user_json.bio }}
-        </p>
       {{ end }}
-
     </div>
 
   </aside>
index 25baea80ad27f2062377757fe8d2e9cb87f80d31..fbad3a0a74a3625ca3fe4dbe3b29f24b333608bc 100644 (file)
@@ -1,21 +1,36 @@
 {{ $author := .context.Params.author }}
 {{ if $author }}
   <aside class="mw5 br3 mv3 nested-links">
-    {{ $urlPre := "https://api.github.com" }}
-    {{ $user_json := getJSON $urlPre "/users/" $author }}
-      {{ if $user_json.name }}
+
+    {{ $data := "" }}
+    {{ $url := urls.JoinPath "https://api.github.com/users" $author }}
+    {{ with resources.GetRemote $url }}
+      {{ with .Err }}
+        {{ errorf "%s" . }}
+      {{ else }}
+        {{ $data = . | transform.Unmarshal }}
+      {{ end }}
+    {{ else }}
+      {{ errorf "Unable to get remote resource %q" $url }}
+    {{ end }}
+
+    {{ with $data }}
+      {{ with .name }}
         <h3 class="f4 dib">
-            {{ $user_json.name | htmlEscape }}
+          {{ . | htmlEscape }}
         </h3>
-
       {{ end }}
-      {{ if $user_json.bio }}
+      {{ with .bio }}
         <p class="lh-copy measure center mt0 f6 black-60">
-          {{ $user_json.bio | htmlEscape }}
+          {{ . | htmlEscape }}
         </p>
       {{ end }}
-      <a href="{{ $user_json.html_url }}" class="link dim v-mid dib">
-        {{ partial "svg/github-squared.svg" (dict "fill" "gray" "width" "16" "height" "18") }}
-      </a>
+      {{ with .html_url }}
+        <a href="{{ . }}" class="link dim v-mid dib">
+          {{ partial "svg/github-squared.svg" (dict "fill" "gray" "width" "16" "height" "18") }}
+        </a>
+      {{ end }}
+    {{ end }}
+
   </aside>
 {{ end }}
index a2429a3350a43432526c3115e7f41ecddb415577..f1fb6d05903d46953e4112a3ca79db1aefe475b9 100644 (file)
                                <a href="{{ .Permalink }}">{{ .Title }}</a>
                        </td>
                        <td class="pv2 ph3">
-                               <a href="{{.Site.Params.ghrepo}}blob/master/content/{{.Lang }}/{{.File.Path}}">
+                               <a href="{{ .Site.Params.ghrepo }}blob/master/content/{{ .Language.Lang }}/{{ .File.Path }}">
                                        {{ with .GitInfo }}{{ .Subject }}{{ else }}Source{{ end }}
                                </a>
                        </td>
                </tr>
                {{ end }}
        </tbody>
-</table>
\ No newline at end of file
+</table>
index defcaa0558e12944a1f5872ac4886ba6bcbd6c7e..b1eb5c8db68b0c721c15b1cea528d6fd45461724 100644 (file)
@@ -2,8 +2,15 @@
 <script>
   MathJax = {
     tex: {
-      displayMath: [['\\[', '\\]'], ['$$', '$$']],  // block
-      inlineMath: [['\\(', '\\)']]                  // inline
+      inlineMath: [['$', '$'], ['\\(', '\\)']],    // inline
+      displayMath: [['$$', '$$'], ['\\[', '\\]']]  // block
+    },
+    startup: {
+      pageReady: () => {
+        return MathJax.startup.defaultPageReady().then(() => {
+          document.body.classList.remove("dn");
+        });
+      }
     }
   };
 </script>
index edf84669e656e2a95070e299420bb55b99aec017..f41e5b79162cba17e8a931cd4be5bbb259f0301e 100644 (file)
@@ -1,3 +1,3 @@
-<a href="{{.Site.Params.ghrepo}}edit/master/content/{{ .Lang }}/{{.File.Path}}" class="
+<a href="{{.Site.Params.ghrepo }}edit/master/content/{{ .Language.Lang }}/{{ .File.Path }}" class="
 f6 ph3 pv1 br2 dib  tc ttu mv3 bg-primary-color white hover-bg-green link
 ">Improve this page</a>
index c21962edd11b955a25f543a9f5fab776c2c4b742..a63ac09b9d6564b24711bf74b3b9aa4436d7a473 100644 (file)
@@ -1 +1 @@
-# github.com/gohugoio/gohugoioTheme v0.0.0-20240126181647-31e47d550511
+# github.com/gohugoio/gohugoioTheme v0.0.0-20240201183016-8e648a3b5342
index 7593fb759714952f69f1072088b19993716e9919..7dee78db25ecad02f67ba6cc08d9103ccf50213d 100644 (file)
@@ -131,9 +131,6 @@ videos
 weight
 : used for [ordering your content in lists][ordering]. Lower weight gets higher precedence. So content with lower weight will come first. If set, weights should be non-zero, as 0 is interpreted as an *unset* weight.
 
-taxonomies
-: Field name of the *plural* form of the index. See `tags` and `categories` in the above front matter examples. *Note that the plural form of user-defined taxonomies cannot be the same as any of the predefined front matter variables.*
-
 {{% note %}}
 If neither `slug` nor `url` is present and [permalinks are not configured otherwise in your site configuration file](/content-management/urls/#permalinks), Hugo will use the file name of your content to create the output URL. See [Content Organization](/content-management/organization) for an explanation of paths in Hugo and [URL Management](/content-management/urls/) for ways to customize Hugo's default behaviors.
 {{% /note %}}
@@ -190,7 +187,7 @@ Any of the above can be omitted.
 {{% note %}}
 When making a site that supports multiple languages, defining a `[[cascade]]` is recommended to be done in [Site Config](../../getting-started/configuration/#cascade) to prevent duplication.
 
-If you instea define a `[[cascade]]` in front matter for multiple languages, an `content/XX/foo/_index.md` file needs to be made on a per-language basis, with `XX` the glob pattern matching the Page's language. In this case, the **lang** keyword is ignored. 
+If you instead define a `[[cascade]]` in front matter for multiple languages, an `content/XX/foo/_index.md` file needs to be made on a per-language basis, with `XX` the glob pattern matching the Page's language. In this case, the **lang** keyword is ignored. 
 {{% /note %}}
 
 ### Example
index d2c71e630978ea842b5511ecf778b0a047e0fa44..b4dca75b12d501c4ffba82315198e49d5e8ea818 100644 (file)
@@ -1,9 +1,9 @@
 ---
 title: Mathematics in markdown
 linkTitle: Mathematics
-description: Include mathematical equations and expressions in your markdown using LaTeX or TeX typsetting syntax.
+description: Include mathematical equations and expressions in your markdown using LaTeX or TeX typesetting syntax.
 categories: [content management]
-keywords: [chemical,chemistry,latex,math,mathjax,tex,typsetting]
+keywords: [chemical,chemistry,latex,math,mathjax,tex,typesetting]
 menu:
   docs:
     parent: content-management
@@ -45,7 +45,7 @@ The approach described below avoids reliance on platform-specific features like
 
 ## Setup
 
-Follow these instructions to include mathematical equations and expressions in your markdown using LaTeX or TeX typsetting syntax.
+Follow these instructions to include mathematical equations and expressions in your markdown using LaTeX or TeX typesetting syntax.
 
 ###### Step 1
 
@@ -122,7 +122,7 @@ The example above loads the partial template if you have set the `math` paramete
 
 ###### Step 4
 
-Include mathematical equations and expressions in your markdown using LaTeX or TeX typsetting syntax.
+Include mathematical equations and expressions in your markdown using LaTeX or TeX typesetting syntax.
 
 {{< code file=content/math-examples.md copy=true >}}
 This is an inline \(a^*=x-b^*\) equation.
index b4de88256085331f2f65c89ef7d4b78be1fa7200..c2eaa93ade900f8ee13cb5873c1bb65250dc52fe 100644 (file)
@@ -11,420 +11,138 @@ weight: 20
 toc: true
 ---
 
-## Introduction
-
-Hugo is an open-source project and lives by the work of its [contributors]. There are plenty of [open issues][issues], and we need your help to make Hugo even more awesome. You don't need to be a Go guru to contribute to the project's development.
-
-## Assumptions
-
-This contribution guide takes a step-by-step approach in hopes of helping newcomers. Therefore, we only assume the following:
-
-* You are new to Git or open-source projects in general
-* You are a fan of Hugo and enthusiastic about contributing to the project
-
-{{% note %}}
-If you're struggling at any point in this contribution guide, reach out to the Hugo community in [Hugo's Discussion forum](https://discourse.gohugo.io).
-{{% /note %}}
-
-## Install Go
-
-The installation of Go should take only a few minutes. You have more than one option to get Go up and running on your machine.
-
-If you are having trouble following the installation guides for Go, check out [Go Bootcamp, which contains setups for every platform][gobootcamp] or reach out to the Hugo community in the [Hugo Discussion Forums][forums].
-
-### Install Go from source
-
-[Download the latest stable version of Go][godl] and follow the official [Go installation guide][goinstall].
-
-Once you're finished installing Go, let's confirm everything is working correctly. Open a terminal---or command line under Windows--and type the following:
-
-```txt
-go version
-```
-
-You should see something similar to the following written to the console. Note that the version here reflects the most recent version of Go as of the last update for this page:
-
-```txt
-go version go1.12 darwin/amd64
-```
-
-Next, make sure that you set up your `GOPATH` [as described in the installation guide][setupgopath].
-
-You can print the `GOPATH` with `echo $GOPATH`. You should see a non-empty string containing a valid path to your Go workspace; for example:
-
-```txt
-/Users/<yourusername>/Code/go
-```
-
-### Install Go with Homebrew
-
-If you are a macOS user and have [Homebrew](https://brew.sh/) installed on your machine, installing Go is as simple as the following command:
-
-{{< code file=install-go.sh >}}
-brew install go
-{{< /code >}}
-
-### Install Go via GVM
-
-More experienced users can use the [Go Version Manager][gvm] (GVM). GVM allows you to switch between different Go versions *on the same machine*. If you're a beginner, you probably don't need this feature. However, GVM makes it easy to upgrade to a new released Go version with just a few commands.
-
-GVM comes in especially handy if you follow the development of Hugo over a longer period of time. Future versions of Hugo will usually be compiled with the latest version of Go. Sooner or later, you will have to upgrade if you want to keep up.
-
-## Create a GitHub account
-
-If you're going to contribute code, you'll need to have an account on GitHub. Go to [www.github.com/join](https://github.com/join) and set up a personal account.
-
-## Install Git on your system
-
-You will need to have Git installed on your computer to contribute to Hugo development. Teaching Git is outside the scope of the Hugo docs, but if you're looking for an excellent reference to learn the basics of Git, we recommend the [Git book][gitbook] if you are not sure where to begin. We will include short explanations of the Git commands in this document.
-
-Git is a [version control system](https://en.wikipedia.org/wiki/Version_control) to track the changes of source code. Hugo depends on smaller third-party packages that are used to extend the functionality. We use them because we don't want to reinvent the wheel.
-
-Go ships with a sub-command called `get` that will download these packages for us when we set up our working environment. The source code of the packages is tracked with Git. `get` will interact with the Git servers of the package hosters in order to fetch all dependencies.
-
-Move back to the terminal and check if Git is already installed. Type in `git version` and press enter. You can skip the rest of this section if the command returned a version number. Otherwise [download](https://git-scm.com/downloads) the latest version of Git and follow this [installation guide](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git).
 
-Finally, check again with `git version` if Git was installed successfully.
 
-### Git graphical front ends
+## Introduction
 
-There are several [GUI clients](https://git-scm.com/downloads/guis) that help you to operate Git. Not all are available for all operating systems and maybe differ in their usage. Because of this we will document how to use the command-line, since the commands are the same everywhere.
+You can contribute to the Hugo project by:
 
-### Install Hub on your system (optional)
+- Answering questions on the [forum]
+- Improving the [documentation]
+- Monitoring the [issue queue]
+- Creating or improving [themes]
+- Squashing [bugs]
 
-Hub is a great tool for working with GitHub. The main site for it is [hub.github.com](https://hub.github.com/). Feel free to install this little Git wrapper.
+Please submit documentation issues and pull requests to the [documentation repository].
 
-On a Mac, you can install [Hub](https://github.com/github/hub) using [Homebrew](https://brew.sh):
+If you have an idea for an enhancement or new feature, create a new topic on the [forum] in the "Feature" category. This will help you to:
 
-```txt
-brew install hub
-```
+- Determine if the capability already exists
+- Measure interest
+- Refine the concept
 
-Now we'll create an [alias in Bash](https://tldp.org/LDP/abs/html/aliases.html) so that typing `git` actually runs `Hub`:
+If there is sufficient interest, [create a proposal]. Do not submit a pull request until the project lead accepts the proposal.
 
-```txt
-echo "alias git='hub'" >> ~/.bash_profile
-```
+For a complete guide to contributing to Hugo, see the [Contribution Guide].
 
-Confirm the installation:
-
-```txt
-git version 2.21.0
-hub version 2.10.0
-```
+[bugs]: https://github.com/gohugoio/hugo/issues?q=is%3Aopen+is%3Aissue+label%3ABug
+[contributing]: CONTRIBUTING.md
+[create a proposal]: https://github.com/gohugoio/hugo/issues/new?labels=Proposal%2C+NeedsTriage&template=feature_request.md
+[documentation repository]: https://github.com/gohugoio/hugoDocs
+[documentation]: https://gohugo.io/documentation
+[forum]: https://discourse.gohugo.io
+[issue queue]: https://github.com/gohugoio/hugo/issues
+[themes]: https://themes.gohugo.io/
+[contribution guide]: https://github.com/gohugoio/hugo/blob/master/CONTRIBUTING.md
 
-## Set up your working copy
+## Prerequisites
 
-You set up the working copy of the repository locally on your computer. Your local copy of the files is what you'll edit, compile, and end up pushing back to GitHub. The main steps are cloning the repository and creating your fork as a remote.
+To build the extended edition of Hugo from source you must:
 
-### Clone the repository
+1. Install [Git]
+1. Install [Go] version 1.20 or later
+1. Install a C compiler, either [GCC] or [Clang]
+1. Update your `PATH` environment variable as described in the [Go documentation]
 
-We assume that you've set up your `GOPATH` (see the section above if you're unsure about this). You should now copy the Hugo repository down to your computer. You'll hear this called "clone the repo". GitHub's [help pages](https://help.github.com/articles/cloning-a-repository/) give us a short explanation:
+[Clang]: https://clang.llvm.org/
+[GCC]: https://gcc.gnu.org/
+[Git]: https://git-scm.com/book/en/v2/Getting-Started-Installing-Git
+[Go documentation]: https://go.dev/doc/code#Command
+[Go]: https://go.dev/doc/install
 
 {{% note %}}
-When you create a repository on GitHub, it exists as a remote repository. You can create a local clone of your repository on your computer and sync between the two locations.
+See these [detailed instructions](https://discourse.gohugo.io/t/41370) to install GCC on Windows.
 {{% /note %}}
 
-We're going to clone the [master Hugo repository](https://github.com/gohugoio/hugo). That seems counter-intuitive, since you won't have commit rights on it. But it's required for the Go workflow. You'll work on a copy of the master and push your changes to your own repository on GitHub.
-
-So, let's make a new directory and clone that master repository:
-
-```txt
-mkdir $HOME/src
-cd $HOME/src
-git clone https://github.com/gohugoio/hugo.git
-```
-
-Since Hugo 0.48, Hugo uses the Go Modules support built into Go 1.11 to build. The easiest is to clone Hugo in a directory outside of GOPATH
-
-And then, install dependencies of Hugo by running the following in the cloned directory:
-
-```txt
-cd $HOME/src/hugo
-go install
-```
-
-Hugo relies on [mage](https://github.com/magefile/mage) for some convenient build and test targets. If you don't already have it, get it:
-
-```txt
-go install github.com/magefile/mage@latest
-```
-
-### Fork the repository
-
-If you're not familiar with this term, GitHub's [help pages](https://help.github.com/articles/fork-a-repo/) provide again a simple explanation:
+## GitHub workflow
 
 {{% note %}}
-A fork is a copy of a repository. Forking a repository allows you to freely experiment with changes without affecting the original project.
+This section assumes that you have a working knowledge of Go, Git and GitHub, and are comfortable working on the command line.
 {{% /note %}}
 
-#### Fork by hand
+Use this workflow to create and submit pull requests.
 
-Open the [Hugo repository](https://github.com/gohugoio/hugo) on GitHub and click on the "Fork" button in the top right.
+Step 1
+: Fork the [project repository].
 
-![Fork button](/images/contribute/development/forking-a-repository.png)
+[project repository]: https://github.com/gohugoio/hugo/
 
-Now open your fork repository on GitHub and copy the remote URL of your fork. You can choose between HTTPS and SSH as protocol that Git should use for the following operations. HTTPS works always [if you're not sure](https://help.github.com/articles/which-remote-url-should-i-use/).
+Step 2
+: Clone your fork.
 
-![Copy remote url](/images/contribute/development/copy-remote-url.png)
+Step 3
+: Create a new branch with a descriptive name that includes the corresponding issue number.
 
-Switch back to the terminal and move into the directory of the cloned master repository from the last step.
+For a new feature:
 
-```txt
-cd $HOME/src/hugo
+```sh
+git checkout -b feat/implement-some-feature-99999
 ```
 
-Now Git needs to know that our fork exists by adding the copied remote url:
+For a bug fix:
 
-```txt
-git remote add <YOUR-GITHUB-USERNAME> <COPIED REMOTE-URL>
+```sh
+git checkout -b fix/fix-some-bug-99999
 ```
 
-#### Fork with Hub
+Step 4
+: Make changes.
 
-Alternatively, you can use the Git wrapper Hub. Hub makes forking a repository easy:
+Step 5
+: Compile and install:
 
-```txt
-git fork
+```text
+CGO_ENABLED=1 go install -tags extended
 ```
 
-That command will log in to GitHub using your account, create a fork of the repository that you're currently working in, and add it as a remote to your working copy.
-
-#### Trust, but verify
+Step 6
+: Test your changes:
 
-Let's check if everything went right by listing all known remotes:
-
-```txt
-git remote -v
+```text
+go test ./...
 ```
 
-The output should look similar:
-
-```txt
-digitalcraftsman    git@github.com:digitalcraftsman/hugo.git (fetch)
-digitalcraftsman    git@github.com:digitalcraftsman/hugo.git (push)
-origin  https://github.com/gohugoio/hugo (fetch)
-origin  https://github.com/gohugoio/hugo (push)
-```
-
-## The Hugo Git contribution workflow
-
-### Create a new branch
-
-You should never develop against the "master" branch. The development team will not accept a pull request against that branch. Instead, create a descriptive named branch and work on it.
-
-First, you should always pull the latest changes from the master repository:
-
-```txt
-git checkout master
-git pull
-```
-
-Now we can create a new branch for your additions:
-
-```txt
-git checkout -b <BRANCH-NAME>
-```
-
-You can check on which branch you are with `git branch`. You should see a list of all local branches. The current branch is indicated with a little asterisk.
-
-### Contribute to documentation
-
-Perhaps you want to start contributing to the Hugo docs. If so, you can ignore most of the following steps and focus on the `/docs` directory within your newly cloned repository. You can change directories into the Hugo docs using `cd docs`.
-
-You can start Hugo's built-in server via `hugo server`. Browse the documentation by entering [http://localhost:1313](http://localhost:1313) in the address bar of your browser. The server automatically updates the page whenever you change content.
-
-We have developed a [separate Hugo documentation contribution guide][docscontrib] for more information on how the Hugo docs are built, organized, and improved by the generosity of people like you.
+Step 7
+: Commit your changes with a descriptive commit message:
 
-### Build Hugo
+- Provide a summary on the first line, typically 50 characters or less, followed by a blank line.
+- Optionally, provide a detailed description where each line is 80 characters or less, followed by a blank line.
+- Add one or more "Fixes" or "Closes" keywords, each on its own line, referencing the [issues] addressed by this change.
 
-While making changes in the codebase it's a good idea to build the binary to test them:
-
-```txt
-mage hugo
-```
-
-This command generates the binary file at the root of the repository.
-
-If you want to install the binary in `$GOPATH/bin`, run
-
-```txt
-mage install
-```
-
-### Test
-
-Sometimes changes on the codebase can cause unintended side effects. Or they don't work as expected. Most functions have their own test cases. You can find them in files ending with `_test.go`.
-
-Make sure the commands
-
-```txt
-mage -v check
-```
-
-passes.
-
-### Formatting
-
-The Go code style guide maybe is opinionated but it ensures that the codebase looks the same, regardless who wrote the code. Go comes with its own formatting tool. Let's apply the style guide to our additions:
-
-```txt
-mage fmt
-```
-
-Once you made your additions commit your changes. Make sure that you follow our [code contribution guidelines](https://github.com/gohugoio/hugo/blob/master/CONTRIBUTING.md):
-
-```txt
-# Add all changed files
-git add --all
-git commit --message "YOUR COMMIT MESSAGE"
-```
-
-The commit message should describe what the commit does (e.g. add feature XYZ), not how it is done.
-
-### Modify commits
-
-You noticed some commit messages don't fulfill the code contribution guidelines or you just forget something to add some files? No problem. Git provides the necessary tools to fix such problems. The next two methods cover all common cases.
-
-If you are unsure what a command does leave the commit as it is. We can fix your commits later in the pull request.
-
-#### Modify the last commit
-
-Let's say you want to modify the last commit message. Run the following command and replace the current message:
-
-```txt
-git commit --amend -m"YOUR NEW COMMIT MESSAGE"
-```
-
-Take a look at the commit log to see the change:
-
-```txt
-git log
-# Exit with q
-```
-
-After making the last commit you may have forgotten something. There is no need to create a new commit. Just add the latest changes and merge them into the intended commit:
-
-```txt
-git add --all
-git commit --amend
-```
-
-#### Modify multiple commits
-
-{{% note %}}
-Modifications such as those described in this section can have serious unintended consequences. Skip this section if you're not sure!
-{{% /note %}}
-
-This is a bit more advanced. Git allows you to [rebase](https://git-scm.com/docs/git-rebase) commits interactively. In other words: it allows you to rewrite the commit history.
-
-```txt
-git rebase --interactive @~6
-```
-
-The `6` at the end of the command represents the number of commits that should be modified. An editor should open and present a list of last six commit messages:
-
-```txt
-pick 80d02a1 tpl: Add hasPrefix to template function smoke test"
-pick aaee038 tpl: Sort the smoke tests
-pick f0dbf2c tpl: Add the other test case for hasPrefix
-pick 911c35b Add "How to contribute to Hugo" tutorial
-pick 33c8973 Begin workflow
-pick 3502f2e Refactoring and typo fixes
-```
-
-In the case above we should merge the last two commits in the commit of this tutorial (`Add "How to contribute to Hugo" tutorial`). You can "squash" commits, i.e. merge two or more commits into a single one.
-
-All operations are written before the commit message. Replace "pick" with an operation. In this case `squash` or `s` for short:
-
-```txt
-pick 80d02a1 tpl: Add hasPrefix to template function smoke test"
-pick aaee038 tpl: Sort the smoke tests
-pick f0dbf2c tpl: Add the other test case for hasPrefix
-pick 911c35b Add "How to contribute to Hugo" tutorial
-squash 33c8973 Begin workflow
-squash 3502f2e Refactoring and typo fixes
-```
-
-We also want to rewrite the commits message of the third last commit. We forgot "docs:" as prefix according to the code contribution guidelines. The operation to rewrite a commit is called `reword` (or `r` as shortcut).
-
-You should end up with a similar setup:
-
-```txt
-pick 80d02a1 tpl: Add hasPrefix to template function smoke test"
-pick aaee038 tpl: Sort the smoke tests
-pick f0dbf2c tpl: Add the other test case for hasPrefix
-reword 911c35b Add "How to contribute to Hugo" tutorial
-squash 33c8973 Begin workflow
-squash 3502f2e Refactoring and typo fixes
-```
-
-Close the editor. It should open again with a new tab. A text is instructing you to define a new commit message for the last two commits that should be merged (aka "squashed"). Save the file with <kbd>CTRL</kbd>+<kbd>S</kbd> and close the editor again.
-
-A last time a new tab opens. Enter a new commit message and save again. Your terminal should contain a status message. Hopefully this one:
-
-```txt
-Successfully rebased and updated refs/heads/<BRANCHNAME>.
-```
+[issues]: https://github.com/gohugoio/hugo/issues
 
-Check the commit log if everything looks as expected. Should an error occur you can abort this rebase with `git rebase --abort`.
+For example:
 
-### Push commits
+```sh
+git commit -m "tpl/strings: Create wrap function
 
-To push our commits to the fork on GitHub we need to specify a destination. A destination is defined by the remote and a branch name. Earlier, the defined that the remote URL of our fork is the same as our GitHub handle, in my case `digitalcraftsman`. The branch should have the same as our local one. This makes it easy to identify corresponding branches.
+The strings.Wrap function wraps a string into one or more lines,
+splitting the string after the given number of characters, but not
+splitting in the middle of a word.
 
-```txt
-git push --set-upstream <YOUR-GITHUB-USERNAME> <BRANCHNAME>
+Fixes #99998
+Closes #99999"
 ```
 
-Now Git knows the destination. Next time when you to push commits you just need to enter `git push`.
-
-If you modified your commit history in the last step GitHub will reject your try to push. This is a safety-feature because the commit history isn't the same and new commits can't be appended as usual. You can enforce this push explicitly with `git push --force`.
-
-## Open a pull request
-
-We made a lot of progress. Good work. In this step we finally open a pull request to submit our additions. Open the [Hugo master repository](https://github.com/gohugoio/hugo/) on GitHub in your browser.
-
-You should find a green button labeled with "New pull request". But GitHub is clever and probably suggests you a pull request like in the beige box below:
-
-![Open a pull request](/images/contribute/development/open-pull-request.png)
-
-The new page summaries the most important information of your pull request. Scroll down and you find the additions of all your commits. Make sure everything looks as expected and click on "Create pull request".
+See the [commit message guidelines] for details.
 
-### Accept the contributor license agreement
+[commit message guidelines]: https://github.com/gohugoio/hugo/blob/master/CONTRIBUTING.md#git-commit-message-guidelines
 
-Last but not least you should accept the contributor license agreement (CLA). A new comment should be added automatically to your pull request. Click on the yellow badge, accept the agreement and authenticate yourself with your GitHub account. It just takes a few clicks and only needs to be done once.
+Step 8
+: Push the new branch to your fork of the documentation repository.
 
-![Accept the CLA](/images/contribute/development/accept-cla.png)
+Step 9
+: Visit the [project repository] and create a pull request (PR).
 
-### Automatic builds
-
-We use a GitHub Actions workflow to build and test. This is a matrix build across combinations of operating system (macOS, Windows, and Ubuntu) and Go versions. The workflow is triggered by the submission of a pull request. If you are a first-time contributor, the workflow requires approval from a project maintainer.
-
-## Where to start?
-
-Thank you for reading through this contribution guide. Hopefully, we will see you again soon on GitHub. There are plenty of [open issues][issues] for you to help with.
-
-Feel free to [open an issue][newissue] if you think you found a bug or you have a new idea to improve Hugo. We are happy to hear from you.
-
-## Additional references for learning Git and Go
-
-* [Codecademy's Free "Learn Git" Course][codecademy] (Free)
-* [Code School and GitHub's "Try Git" Tutorial][trygit] (Free)
-* [The Git Book][gitbook] (Free)
-* [Go Bootcamp][gobootcamp]
-
-[codecademy]: https://www.codecademy.com/learn/learn-git
-[contributors]: https://github.com/gohugoio/hugo/graphs/contributors
-[docscontrib]: /contribute/documentation/
-[forums]: https://discourse.gohugo.io
-[gitbook]: https://git-scm.com/
-[gobootcamp]: https://www.golang-book.com/guides/machine_setup
-[godl]: https://go.dev/dl/
-[goinstall]: https://go.dev/doc/install
-[gvm]: https://github.com/moovweb/gvm
-[issues]: https://github.com/gohugoio/hugo/issues
-[newissue]: https://github.com/gohugoio/hugo/issues/new
-[releases]: /getting-started/
-[setupgopath]: https://go.dev/doc/code#Workspaces
-[trygit]: https://try.github.io/levels/1/challenges/1
+Step 10
+: A project maintainer will review your PR and may request changes. You may delete your branch after the maintainer merges your PR.
index 862df619f8c453d9891a4c7c1be60439da1c7315..b0c376839f25a06a8cf908496af6ef2f0da8fe18 100644 (file)
@@ -325,32 +325,44 @@ Step 2
 : Clone your fork.
 
 Step 3
-: Create a new branch with a descriptive name.
+: Create a new branch with a descriptive name that includes the corresponding issue number, if any:
 
 ```sh
-git checkout -b fix/typos-shortcode-templates
+git checkout -b restructure-foo-page-99999
 ```
 
 Step 4
 : Make changes.
 
 Step 5
-: Commit your changes with a descriptive commit message, typically 50 characters or less. Add the "Closes" keyword if your change addresses one or more open [issues].
+: Build the site locally to preview your changes.
+
+Step 6
+: Commit your changes with a descriptive commit message:
+
+- Provide a summary on the first line, typically 50 characters or less, followed by a blank line.
+- Optionally, provide a detailed description where each line is 80 characters or less, followed by a blank line.
+- Optionally, add one or more "Fixes" or "Closes" keywords, each on its own line, referencing the [issues] addressed by this change.
+
+For example:
 
 ```sh
-git commit -m "Fix typos on the shortcode templates page
+git commit -m "Restructure the taxonomy page
+
+This restructures the taxonomy page by splitting topics into logical
+sections, each with one or more examples.
 
-Closes #1234
-Closes #5678"
+Fixes #9999
+Closes #9998"
 ```
 
-Step 6
+Step 7
 : Push the new branch to your fork of the documentation repository.
 
-Step 7
+Step 8
 : Visit the [documentation repository] and create a pull request (PR).
 
-Step 8
+Step 9
 : A project maintainer will review your PR and may request changes. You may delete your branch after the maintainer merges your PR.
 
 [ATX]: https://spec.commonmark.org/0.30/#atx-headings
index afa8d48aabea026cde0e68c651c500fccf29f00f..a438a3d53504babed72e7c846821dfb35f51e0e7 100644 (file)
@@ -22,3 +22,9 @@ If one of the numbers is a [`float`], the result is a `float`.
 ```
 
 [`float`]: /getting-started/glossary/#float
+
+You can also use the `add` function to concatenate strings.
+
+```go-html-template
+{{ add "hu" "go" }} → hugo
+```
index 63af850b7e7065cc21efedd44925cef01b4856be..f4a5389d9814116732150d7009c85bd699414fb7 100644 (file)
@@ -47,5 +47,3 @@ news → true
 Note that `os.ReadDir` is not recursive.
 
 Details of the `FileInfo` structure are available in the [Go documentation](https://pkg.go.dev/io/fs#FileInfo).
-
-For more information on using `readDir` and `readFile` in your templates, see [Local File Templates](/templates/files).
index 654e300ac88a6ffa762b6bbdeff320f15520fd98..5e733ef2d9406bd839755af1a340b787a52d8f43 100644 (file)
@@ -36,5 +36,3 @@ This is **bold** text.
 ```
 
 Note that `os.ReadFile` returns raw (uninterpreted) content.
-
-For more information on using `readDir` and `readFile` in your templates, see [Local File Templates](/templates/files).
index 0e6b91b641c63295b44f7c1acc157e566f17c8f1..e596b2ab6b0d50d41d0d331176ee078ac5bf6b6c 100644 (file)
@@ -175,3 +175,41 @@ Override the cache key by setting a `key` in the options map. Use this approach
 ```
 
 [configure file caches]: /getting-started/configuration/#configure-file-caches
+
+## Security
+
+To protect against malicious intent, the `resources.GetRemote` function inspects the server response including:
+
+- The [Content-Type] in the response header
+- The file extension, if any
+- The content itself
+
+If Hugo is unable to resolve the media type to an entry in its [allowlist], the function throws an error:
+
+```text
+ERROR error calling resources.GetRemote: failed to resolve media type...
+```
+
+For example, you will see the error above if you attempt to download an executable.
+
+Although the allowlist contains entries for common media types, you may encounter situations where Hugo is unable to resolve the media type of a file that you know to be safe. In these situations, edit your site configuration to add the media type to the allowlist. For example:
+
+```text
+[security.http]
+mediaTypes=['application/vnd\.api\+json'] 
+```
+
+Note that the entry above is:
+
+- An _addition_ to the allowlist; it does not _replace_ the allowlist
+- An array of regular expressions
+
+For example, to add two entries to the allowlist:
+
+```text
+[security.http]
+mediaTypes=['application/vnd\.api\+json','image/avif']
+```
+
+[allowlist]: https://en.wikipedia.org/wiki/Whitelist
+[Content-Type]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Type
index 929feb5424e148a63ebcb481dc368bb521295250..d4c1d0e26caa5577fce7b8e8f78f91fc3772a216 100644 (file)
@@ -11,6 +11,26 @@ weight: 60
 # Use level 6 headings for each term in the glossary.
 ---
 
+[A](#action)
+[B](#bool)
+[C](#cache)
+[D](#default-sort-order)
+[E](#environment)
+[F](#field)
+[G](#global-resource)
+[I](#identifier)
+[K](#kind)
+[L](#layout)
+[M](#map)
+[O](#object)
+[P](#page-bundle)
+[R](#regular-page)
+[S](#scalar)
+[T](#taxonomic-weight)
+[U](#unmarshal)
+[V](#variable)
+[W](#walk)
+
 ###### action
 
 See [template action](#template-action).
index 3d79d15c5b5b52eab187c633ca99179825f9ec16..13416ada74f8e3d752e505f10ef87df2183faea3 100644 (file)
@@ -18,7 +18,7 @@ With this front matter:
 title = 'Annual conference'
 date = 2023-10-17T15:11:37-07:00
 display_related = true
-[params.author]
+[author]
   email = 'jsmith@example.org'
   name = 'John Smith'
 {{< /code-toggle >}}
index 0aeeb38d82e6effaca595c3171930c3b581f7dcb..64c6cfe67904887909fbf8f9e8b647dd72ae1f15 100644 (file)
@@ -6,7 +6,7 @@ keywords: []
 action:
   related:
     - methods/time/Before
-    - methods/time/After
+    - methods/time/Equal
     - functions/time/AsTime
   returnType: bool
   signatures: [TIME1.After TIME2]
diff --git a/content/en/templates/files.md b/content/en/templates/files.md
deleted file mode 100644 (file)
index 1847af9..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
----
-title: Local file templates
-description: Hugo's `readDir` and `readFile` functions make it easy to traverse your project's directory structure and write file contents to your templates.
-categories: [templates]
-keywords: [files,directories]
-menu:
-  docs:
-    parent: templates
-    weight: 180
-weight: 180
-toc: true
-aliases: [/extras/localfiles/,/templates/local-files/]
----
-
-## Traverse local files
-
-With Hugo's [`readDir`] and [`readFile`] template functions, you can traverse your website's files on your server.
-
-## Use `readDir`
-
-The [`readDir`] function returns an array of [`os.FileInfo`] structures. It takes the file's `path` as a single string argument. This path can be to any directory of your website (i.e., as found on your server's file system).
-
-Whether the path is absolute or relative does not matter because---at least for `readDir`---the root of your website (typically `./public/`) in effect becomes both:
-
-1. The file system root
-2. The current working directory
-
-## Use `readFile`
-
-The [`readfile`] function reads a file from disk and converts it into a string to be manipulated by other Hugo functions or added as-is. `readFile` takes the file, including path, as an argument passed to the function.
-
-To use the `readFile` function in your templates, make sure the path is relative to your *Hugo project's root directory*:
-
-```go-html-template
-{{ readFile "/content/templates/local-file-templates" }}
-```
-
-### `readFile` Example: Add a Project File to Content
-
-As `readFile` is a function, it is only available to you in your templates and not your content. However, we can create a simple [shortcode template][sct] that calls `readFile`, passes the first argument through the function, and then allows an optional second argument to send the file through the Markdown processor. The pattern for adding this shortcode to your content will be as follows:
-
-```go-html-template
-{{</* readfile file="/path/to/local/file.txt" markdown="true" */>}}
-```
-
-{{% note %}}
-If you are going to create [custom shortcodes](/templates/shortcode-templates/) with `readFile` for a theme, note that usage of the shortcode will refer to the project root and *not* your `themes` directory.
-{{% /note %}}
-
-[called directly in the Hugo docs]: https://github.com/gohugoio/hugoDocs/blob/master/content/en/templates/files.md
-[`os.FileInfo`]: https://pkg.go.dev/io/fs#FileInfo
-[`readDir`]: /functions/os/readdir
-[`readFile`]: /functions/os/readfile
-[sc]: /content-management/shortcodes/
-[sct]: /templates/shortcode-templates/
-[readfilesource]: https://github.com/gohugoio/hugoDocs/blob/master/layouts/shortcodes/readfile.html
index 23a42088254be0a5eb5727f1eccef95dddc70113..0e95f3ffb78be8cc022b1573fc25df871e785118 100644 (file)
@@ -85,9 +85,6 @@ The above example is fictional, but if used for the homepage on a site with `bas
 
 The following is the full list of configuration options for output formats and their default values:
 
-name
-: the output format identifier. This is used to define what output format(s) you want for your pages.
-
 mediaType
 : this must match the `Type` of a defined media type.
 
index 8e174bdee20cafb0cdc2425cc25a209aea3fadc4..f91cb6b6ec6e004796a4e0b594e9b37de4940806 100644 (file)
@@ -128,7 +128,7 @@ Here is a code example for how the render-image.html template could look:
 Given this template file
 
 {{< code file=layouts/_default/_markup/render-heading.html >}}
-<h{{ .Level }} id="{{ .Anchor | safeURL }}">{{ .Text | safeHTML }} <a href="#{{ .Anchor | safeURL }}">¶</a></h{{ .Level }}>
+<h{{ .Level }} id="{{ .Anchor }}">{{ .Text | safeHTML }} <a href="#{{ .Anchor | safeURL }}">¶</a></h{{ .Level }}>
 {{< /code >}}
 
 And this markdown
diff --git a/go.mod b/go.mod
index 4866a61d6e5245edb5ca8ef5526018e886f097e7..e3420f6ae0d4a90b4249675ff7373de8083b1148 100644 (file)
--- a/go.mod
+++ b/go.mod
@@ -2,4 +2,4 @@ module github.com/gohugoio/hugoDocs
 
 go 1.16
 
-require github.com/gohugoio/gohugoioTheme v0.0.0-20240126181647-31e47d550511 // indirect
+require github.com/gohugoio/gohugoioTheme v0.0.0-20240201183016-8e648a3b5342 // indirect
diff --git a/go.sum b/go.sum
index 9f3ed23f1dc9060efa12a1a5046ca3c9a6defa92..e6a4fcd6c4255bb6f7aea2f11ea54e719565acf3 100644 (file)
--- a/go.sum
+++ b/go.sum
@@ -1,2 +1,2 @@
-github.com/gohugoio/gohugoioTheme v0.0.0-20240126181647-31e47d550511 h1:dJLsByAuk9RnZmjL6QxQzHTJ63dr7Cwx6Dj8KAm7uEI=
-github.com/gohugoio/gohugoioTheme v0.0.0-20240126181647-31e47d550511/go.mod h1:GOYeAPQJ/ok8z7oz1cjfcSlsFpXrmx6VkzQ5RpnyhZM=
+github.com/gohugoio/gohugoioTheme v0.0.0-20240201183016-8e648a3b5342 h1:jQaO+i2osHeIZ+V7Dvo7CPqN6jPwMRjt7b9QaX7HXE4=
+github.com/gohugoio/gohugoioTheme v0.0.0-20240201183016-8e648a3b5342/go.mod h1:GOYeAPQJ/ok8z7oz1cjfcSlsFpXrmx6VkzQ5RpnyhZM=
diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html
new file mode 100644 (file)
index 0000000..beb2d86
--- /dev/null
@@ -0,0 +1,124 @@
+<!doctype html>
+<html
+  class="no-js"
+  lang="{{ with $.Site.LanguageCode }}
+    {{ . }}
+  {{ else }}
+    en-us
+  {{ end }}
+  ">
+  <head>
+    <meta charset="utf-8" />
+    {{/* https://www.zachleat.com/web/preload/ */}}
+    <link
+      rel="preload"
+      href="{{ "fonts/muli-latin-200.woff2" | absURL }}"
+      as="font"
+      type="font/woff2"
+      crossorigin />
+    <link
+      rel="preload"
+      href="{{ "fonts/muli-latin-400.woff2" | absURL }}"
+      as="font"
+      type="font/woff2"
+      crossorigin />
+    <link
+      rel="preload"
+      href="{{ "fonts/muli-latin-800.woff2" | absURL }}"
+      as="font"
+      type="font/woff2"
+      crossorigin />
+
+    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
+    {{/* NOTE: the Site's title, and if there is a page title, that is set too */}}
+    <title>
+      {{ block "title" . }}
+        {{ with .Title }}{{ . }} | {{ end }}{{ .Site.Title }}
+      {{ end }}
+
+    </title>
+
+    <meta name="viewport" content="width=device-width,minimum-scale=1" />
+    {{ hugo.Generator }}
+
+    {{ if hugo.IsProduction }}
+      <meta name="robots" content="index, follow" />
+    {{ else }}
+      <meta name="robots" content="noindex, nofollow" />
+    {{ end }}
+
+    {{ range .AlternativeOutputFormats -}}
+      <link
+        rel="{{ .Rel }}"
+        type="{{ .MediaType.Type }}"
+        href="{{ .Permalink | safeURL }}" />
+    {{ end -}}
+
+    {{ $isDev := eq hugo.Environment "development" }}
+    {{ $stylesheet := resources.Get "output/css/app.css" }}
+    {{ if not $isDev }}
+      {{ $stylesheet = $stylesheet | minify | fingerprint }}
+    {{ end }}
+    {{ with $stylesheet }}
+      {{ if $isDev }}
+        <link
+          rel="stylesheet"
+          href="{{ .RelPermalink }}"
+          crossorigin="anonymous" />
+      {{ else }}
+        <link
+          rel="stylesheet"
+          href="{{ .RelPermalink }}"
+          integrity="{{ .Data.Integrity }}"
+          crossorigin="anonymous" />
+      {{ end }}
+      {{ $.Scratch.Set "stylesheet" . }}
+    {{ end }}
+
+
+    <meta
+      name="description"
+      content="{{ with .Description }}
+        {{ . }}
+      {{ else }}
+        {{ with .Site.Params.description }}{{ . }}{{ end }}
+      {{ end }}
+      " />
+
+    {{ block "scripts" . }}
+      {{- partial "site-scripts.html" . -}}
+    {{ end }}
+    {{ partial "site-manifest.html" . }}
+    {{- partial "head-additions.html" . -}}
+    {{- partial "opengraph/opengraph.html" . -}}
+    {{- template "_internal/schema.html" . -}}
+    {{- partial "opengraph/twitter_cards.html" . -}}
+
+    {{ if hugo.IsProduction }}
+      {{ partial "gtag.html" . }}
+    {{ end }}
+
+    {{ $hasMath := .Param "math" }}
+    {{ if $hasMath }}
+      {{ partialCached "math.html" . }}
+    {{ end }}
+
+  </head>
+
+  <body
+    class="ma0 sans-serif bg-primary-color-light{{ with getenv "HUGO_ENV" }}
+      {{ . }}
+    {{ end }} {{ if $hasMath }}{{ print " dn" }}{{ end }}">
+    {{ partial "hooks/after-body-start.html" . }}
+    {{ block "nav" . }}{{ partial "site-nav.html" . }}{{ end }}
+    {{ block "header" . }}{{ end }}
+    <main role="main" class="content-with-sidebar min-vh-100 pb7 pb0-ns">
+      {{ block "main" . }}{{ end }}
+    </main>
+
+    {{ block "footer" . }}{{ partialCached "site-footer.html" . }}{{ end }}
+
+    {{ partial "hooks/before-body-end.html" . }}
+
+  </body>
+</html>
diff --git a/layouts/partials/math.html b/layouts/partials/math.html
new file mode 100644 (file)
index 0000000..b1eb5c8
--- /dev/null
@@ -0,0 +1,16 @@
+<script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml.js"></script>
+<script>
+  MathJax = {
+    tex: {
+      inlineMath: [['$', '$'], ['\\(', '\\)']],    // inline
+      displayMath: [['$$', '$$'], ['\\[', '\\]']]  // block
+    },
+    startup: {
+      pageReady: () => {
+        return MathJax.startup.defaultPageReady().then(() => {
+          document.body.classList.remove("dn");
+        });
+      }
+    }
+  };
+</script>