summaryrefslogtreecommitdiffstats
path: root/docs/content
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2023-02-23 07:52:04 +0100
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2023-02-23 07:52:04 +0100
commit7e539cb398d8fa3cb17eba7b8ab4ba88b8e9c2ef (patch)
tree25017e060b2e840e575e962b6c5964a9b347864e /docs/content
parent586fea0de6ea3d389ec6ccc893bdafcf3bc569a0 (diff)
parentcf591b7c0c598d34896709db6d28598da37e3ff6 (diff)
Diffstat (limited to 'docs/content')
-rw-r--r--docs/content/en/functions/dict.md2
-rw-r--r--docs/content/en/functions/findRe.md19
-rw-r--r--docs/content/en/functions/format.md4
-rw-r--r--docs/content/en/functions/highlight.md10
-rw-r--r--docs/content/en/functions/markdownify.md5
-rw-r--r--docs/content/en/functions/uniq.md19
-rw-r--r--docs/content/en/functions/urls.Parse.md2
-rw-r--r--docs/content/en/getting-started/configuration-markup.md2
-rw-r--r--docs/content/en/getting-started/configuration.md9
-rw-r--r--docs/content/en/getting-started/external-learning-resources/index.md2
-rw-r--r--docs/content/en/hugo-pipes/js.md8
-rw-r--r--docs/content/en/templates/404.md2
-rw-r--r--docs/content/en/templates/introduction.md12
-rw-r--r--docs/content/en/tools/search.md1
14 files changed, 63 insertions, 34 deletions
diff --git a/docs/content/en/functions/dict.md b/docs/content/en/functions/dict.md
index 5c8ad9d8a..dd1e2cd5b 100644
--- a/docs/content/en/functions/dict.md
+++ b/docs/content/en/functions/dict.md
@@ -31,7 +31,7 @@ The partial below creates an SVG and expects `fill`, `height` and `width` from t
### Partial definition
{{< code file="layouts/partials/svgs/external-links.svg" download="external-links.svg" >}}
-<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
fill="{{ .fill }}" width="{{ .width }}" height="{{ .height }}" viewBox="0 0 32 32" aria-label="External Link">
<path d="M25.152 16.576v5.696q0 2.144-1.504 3.648t-3.648 1.504h-14.848q-2.144 0-3.648-1.504t-1.504-3.648v-14.848q0-2.112 1.504-3.616t3.648-1.536h12.576q0.224 0 0.384 0.16t0.16 0.416v1.152q0 0.256-0.16 0.416t-0.384 0.16h-12.576q-1.184 0-2.016 0.832t-0.864 2.016v14.848q0 1.184 0.864 2.016t2.016 0.864h14.848q1.184 0 2.016-0.864t0.832-2.016v-5.696q0-0.256 0.16-0.416t0.416-0.16h1.152q0.256 0 0.416 0.16t0.16 0.416zM32 1.152v9.12q0 0.48-0.352 0.8t-0.8 0.352-0.8-0.352l-3.136-3.136-11.648 11.648q-0.16 0.192-0.416 0.192t-0.384-0.192l-2.048-2.048q-0.192-0.16-0.192-0.384t0.192-0.416l11.648-11.648-3.136-3.136q-0.352-0.352-0.352-0.8t0.352-0.8 0.8-0.352h9.12q0.48 0 0.8 0.352t0.352 0.8z"></path>
</svg>
diff --git a/docs/content/en/functions/findRe.md b/docs/content/en/functions/findRe.md
index 8e08bfc0d..13d43f896 100644
--- a/docs/content/en/functions/findRe.md
+++ b/docs/content/en/functions/findRe.md
@@ -36,5 +36,24 @@ To limit the number of matches to one:
You can write and test your regular expression using [regex101.com](https://regex101.com/). Be sure to select the Go flavor before you begin.
{{% /note %}}
+## findRESubmatch
+
+In Hugo 0.110.0 we added a variant of `findRe` that returns a slice of strings holding the text of the leftmost match of the regular expression in s and the matches, if any, of its subexpressions.
+
+This:
+
+```go-html-template
+{{ findRESubmatch §§<a\s*href="(.+?)">(.+?)</a>§§ §§<li><a href="#foo">Foo</a></li> <li><a href="#bar">Bar</a></li>§§ | print | safeHTML }}
+```
+
+Will print:
+
+```
+[[<a href=\"#foo\">Foo</a> #foo Foo] [<a href=\"#bar\">Bar</a> #bar Bar]]
+```
+
+{{< new-in "0.110.0" >}}
+
+
[RE2]: https://github.com/google/re2/wiki/Syntax
[string literal]: https://go.dev/ref/spec#String_literals
diff --git a/docs/content/en/functions/format.md b/docs/content/en/functions/format.md
index e2f93f1fc..5c86714fe 100644
--- a/docs/content/en/functions/format.md
+++ b/docs/content/en/functions/format.md
@@ -95,10 +95,10 @@ More examples can be found in Go's [documentation for the time package][timecons
Spelled-out cardinal numbers (e.g. "one", "two", and "three") are not currently supported.
-Ordinal abbreviations (i.e., with shorted suffixes like "1st", "2nd", and "3rd") are not currently directly supported. By using `{{.Date.Format "Jan 2nd 2006"}}`, Hugo assumes you want to append `nd` as a string to the day of the month. However, you can chain functions together to create something like this:
+Use the [`humanize`](/functions/humanize) function to render the day of the month as an ordinal number:
```
-{{ .Date.Format "2" }}{{ if in (slice 1 21 31) .Date.Day}}st{{ else if in (slice 2 22) .Date.Day}}nd{{ else if in (slice 3 23) .Date.Day}}rd{{ else }}th{{ end }} of {{ .Date.Format "January 2006" }}
+{{ humanize .Date.Day }} of {{ .Date.Format "January 2006" }}
```
This will output:
diff --git a/docs/content/en/functions/highlight.md b/docs/content/en/functions/highlight.md
index 8324edb81..10b1c2d90 100644
--- a/docs/content/en/functions/highlight.md
+++ b/docs/content/en/functions/highlight.md
@@ -36,19 +36,19 @@ Display a number at the beginning of each line.
lineNumbersInTable
: Boolean. Default is `true`.\
-Render the highlighted code in an HTML table with two cells. The left table cell contains the line numbers. The right table cell contains the code, allowing a user to select and copy the code without line numbers. Irrelevant if `lineNos` is false.
+Render the highlighted code in an HTML table with two cells. The left table cell contains the line numbers. The right table cell contains the code, allowing a user to select and copy the code without line numbers. Irrelevant if `lineNos` is `false`.
anchorLineNos
: Boolean. Default is `false`.\
-Render each line number as an HTML anchor element, and set the `id` attribute of the surrounding `<span>` to the line number. Irrelevant if `lineNos` is false.
+Render each line number as an HTML anchor element, and set the `id` attribute of the surrounding `<span>` to the line number. Irrelevant if `lineNos` is `false`.
lineAnchors
: String. Default is `""`.\
-When rendering a line number as an HTML anchor element, prepend this value to the `id` attribute of the surrounding `<span>`. This provides unique `id` attributes when a page contains two or more code blocks. Irrelevant if `lineNos` or `anchorLineNos` is false.
+When rendering a line number as an HTML anchor element, prepend this value to the `id` attribute of the surrounding `<span>`. This provides unique `id` attributes when a page contains two or more code blocks. Irrelevant if `lineNos` or `anchorLineNos` is `false`.
lineNoStart
: Integer. Default is `1`.\
-The number to display at the beginning of the first line. Irrelevant if `lineNos` is false.
+The number to display at the beginning of the first line. Irrelevant if `lineNos` is `false`.
hl_Lines
: String. Default is `""`.\
@@ -68,7 +68,7 @@ Use inline CSS styles instead of an external CSS file. To use an external CSS fi
tabWidth
: Integer. Default is `4`.\
-Substitute this number of spaces for each tab character in your highlighted code.
+Substitute this number of spaces for each tab character in your highlighted code. Irrelevant if `noClasses` is `false`.
guessSyntax
: Boolean. Default is `false`.\
diff --git a/docs/content/en/functions/markdownify.md b/docs/content/en/functions/markdownify.md
index b42e045e7..8d8726cff 100644
--- a/docs/content/en/functions/markdownify.md
+++ b/docs/content/en/functions/markdownify.md
@@ -4,7 +4,7 @@ linktitle: markdownify
description: Runs the provided string through the Markdown processor.
date: 2017-02-01
publishdate: 2017-02-01
-lastmod: 2017-02-01
+lastmod: 2023-02-09
keywords: [markdown,content]
categories: [functions]
menu:
@@ -23,6 +23,7 @@ aliases: []
{{ .Title | markdownify }}
```
-{{< new-in "0.93.0" >}} **Note**: `markdownify` now supports [Render Hooks] just like [.RenderString](/functions/renderstring/).
+{{< new-in "0.93.0" >}} **Note**: `markdownify` now supports [Render Hooks] just like [`.Page.RenderString`]. However, if you use more complicated [Render Hooks] relying on page context, use [`.Page.RenderString`] instead. See [GitHub issue #9692](https://github.com/gohugoio/hugo/issues/9692) for more details.
[Render Hooks]: /templates/render-hooks/
+[`.Page.RenderString`]: /functions/renderstring/
diff --git a/docs/content/en/functions/uniq.md b/docs/content/en/functions/uniq.md
index eec55e5c3..73ca32488 100644
--- a/docs/content/en/functions/uniq.md
+++ b/docs/content/en/functions/uniq.md
@@ -1,25 +1,18 @@
---
title: uniq
linktitle: uniq
-description: Takes in a slice or array and returns a slice with subsequent duplicate elements removed.
-date: 2017-02-01
-publishdate: 2017-02-01
-lastmod: 2017-02-01
+description: Takes in a slice or array and returns a slice with duplicate elements removed.
categories: [functions]
menu:
docs:
- parent: "functions"
+ parent: functions
keywords: [multilingual,i18n,urls]
-signature: ["uniq SET"]
-workson: []
-hugoversion:
-relatedfuncs: []
-deprecated: false
+signature: [uniq SET]
aliases: []
---
+
```
-{{ uniq (slice 1 2 3 2) }}
-{{ slice 1 2 3 2 | uniq }}
-<!-- both return [1 2 3] -->
+{{ slice 1 3 2 1 | uniq }} --> [1 3 2]
+
```
diff --git a/docs/content/en/functions/urls.Parse.md b/docs/content/en/functions/urls.Parse.md
index 676734210..988ecb3ac 100644
--- a/docs/content/en/functions/urls.Parse.md
+++ b/docs/content/en/functions/urls.Parse.md
@@ -1,6 +1,6 @@
---
title: urls.Parse
-description: Parse parses a given url, which may be relative or absolute, into a URL structure.
+description: Parse parses a given URL, which may be relative or absolute, into a URL structure.
date: 2017-09-25
publishdate: 2017-09-25
lastmod: 2017-09-25
diff --git a/docs/content/en/getting-started/configuration-markup.md b/docs/content/en/getting-started/configuration-markup.md
index b55bd79c4..d1d237b2a 100644
--- a/docs/content/en/getting-started/configuration-markup.md
+++ b/docs/content/en/getting-started/configuration-markup.md
@@ -32,7 +32,7 @@ For details on the extensions, refer to [this section](https://github.com/yuin/g
Some settings explained:
-hardWrap
+hardWraps
: By default, Goldmark ignores newlines within a paragraph. Set to `true` to render newlines as `<br>` elements.
unsafe
diff --git a/docs/content/en/getting-started/configuration.md b/docs/content/en/getting-started/configuration.md
index 3c9b42678..99d11fbb1 100644
--- a/docs/content/en/getting-started/configuration.md
+++ b/docs/content/en/getting-started/configuration.md
@@ -37,6 +37,12 @@ Multiple site config files can be specified as a comma-separated string to the `
{{< todo >}}TODO: distinct config.toml and others (the root object files){{< /todo >}}
+## hugo.toml vs config.toml
+
+In Hugo 0.110.0 we changed the default config base filename to `hugo`, e.g. `hugo.toml`. We will still look for `config.toml` etc., but we recommend you eventually rename it (but you need to wait if you want to support older Hugo versions). The main reason we're doing this is to make it easier code editors and build tools to identify this as a Hugo configuration file and project.
+
+{{< new-in "0.110.0" >}}
+
## Configuration Directory
In addition to using a single site config file, one can use the `configDir` directory (default to `config/`) to maintain easier organization and environment specific settings.
@@ -117,8 +123,7 @@ Note that you don't need to be so verbose as in the default setup below; a `_mer
## All Configuration Settings
-The following is the full list of Hugo-defined variables with their default
-value in parentheses. Users may choose to override those values in their site
+The following is the full list of Hugo-defined variables. Users may choose to override those values in their site
config file(s).
### archetypeDir
diff --git a/docs/content/en/getting-started/external-learning-resources/index.md b/docs/content/en/getting-started/external-learning-resources/index.md
index 7102e0831..61e7ed649 100644
--- a/docs/content/en/getting-started/external-learning-resources/index.md
+++ b/docs/content/en/getting-started/external-learning-resources/index.md
@@ -34,7 +34,7 @@ Hugo in Action is a step-by-step guide to using Hugo to create static websites.
### Hugo tutorial by CloudCannon
-[Step-by-step written tutorial](https://cloudcannon.com/community/learn/hugo-101/) to teach you the basics of creating a Hugo site.
+[Step-by-step written tutorial](https://cloudcannon.com/community/learn/hugo-beginner-tutorial/) to teach you the basics of creating a Hugo site.
## Video tutorials
diff --git a/docs/content/en/hugo-pipes/js.md b/docs/content/en/hugo-pipes/js.md
index c95688e68..6905a6555 100644
--- a/docs/content/en/hugo-pipes/js.md
+++ b/docs/content/en/hugo-pipes/js.md
@@ -41,7 +41,7 @@ minify [bool]
inject [slice]
: This option allows you to automatically replace a global variable with an import from another file. The path names must be relative to `assets`. See https://esbuild.github.io/api/#inject
-shims
+shims [map]
: This option allows swapping out a component with another. A common use case is to load dependencies like React from a CDN (with _shims_) when in production, but running with the full bundled `node_modules` dependency during development:
```go-html-template
@@ -84,13 +84,13 @@ defines [map]
{{ $defines := dict "process.env.NODE_ENV" `"development"` }}
```
-format [string]
+format [string]
: The output format.
One of: `iife`, `cjs`, `esm`.
Default is `iife`, a self-executing function, suitable for inclusion as a <script> tag.
-sourceMap
-: Whether to generate `inline` or `external` sourcemap from esbuild. External sourcemaps will be written to the target with the output filename + ".map". Input sourcemaps can be read from js.Build and node modules and combined into the output sourcemaps.
+sourceMap [string]
+: Whether to generate `inline` or `external` source maps from esbuild. External source maps will be written to the target with the output filename + ".map". Input source maps can be read from js.Build and node modules and combined into the output source maps. By default, source maps are not created.
### Import JS code from /assets
diff --git a/docs/content/en/templates/404.md b/docs/content/en/templates/404.md
index 81c4c38bd..f0d2ecd9a 100644
--- a/docs/content/en/templates/404.md
+++ b/docs/content/en/templates/404.md
@@ -16,7 +16,7 @@ aliases: []
toc: false
---
-When using Hugo with [GitHub Pages](https://pages.github.com/), you can provide your own template for a [custom 404 error page](https://docs.github.com/en/pages/getting-started-with-github-pages/creating-a-custom-404-page-for-your-github-pages-site) by creating a 404.html template file in your `/layouts` folder. When Hugo generates your site, the `404.html` file will be placed in the root.
+When using Hugo with [GitHub Pages](https://pages.github.com/), you can provide your own template for a [custom 404 error page](https://docs.github.com/en/pages/getting-started-with-github-pages/creating-a-custom-404-page-for-your-github-pages-site) by creating a 404.html template file in the root of your `layouts` folder. When Hugo generates your site, the `404.html` file will be placed in the root.
404 pages will have all the regular [page variables][pagevars] available to use in the templates.
diff --git a/docs/content/en/templates/introduction.md b/docs/content/en/templates/introduction.md
index 87b7cab35..5145b04be 100644
--- a/docs/content/en/templates/introduction.md
+++ b/docs/content/en/templates/introduction.md
@@ -496,7 +496,17 @@ Will render `Bonsoir, Eliott.`, and not care about the syntax error (`add 0 + 2`
### HTML comments
-If you need to produce HTML comments from your templates, take a look at the [Internet Explorer conditional comments]({{< relref "introduction.md#ie-conditional-comments" >}}) example. If you need variables to construct such HTML comments, just pipe `printf` to `safeHTML`. For example:
+You can add html comments by piping a string HTML code comment to `safeHTML`.
+
+For example:
+
+```go-html-template
+{{ "<!-- This is an HTML comment -->" | safeHTML }}
+```
+
+If you need variables to construct such HTML comments, just pipe `printf` to `safeHTML`.
+
+For example:
```go-html-template
{{ printf "<!-- Our website is named: %s -->" .Site.Title | safeHTML }}
diff --git a/docs/content/en/tools/search.md b/docs/content/en/tools/search.md
index 97ddeaf01..464aa9107 100644
--- a/docs/content/en/tools/search.md
+++ b/docs/content/en/tools/search.md
@@ -27,6 +27,7 @@ A static website with a dynamic search function? Yes, Hugo provides an alternati
* [hugofastsearch](https://gist.github.com/cmod/5410eae147e4318164258742dd053993). A usability and speed update to "GitHub Gist for Fuse.js integration" — global, keyboard-optimized search.
* [JS & Fuse.js tutorial](https://makewithhugo.com/add-search-to-a-hugo-site/) A simple client-side search solution, using FuseJS (does not require jQuery).
* [Pagefind](https://github.com/cloudcannon/pagefind). A fully static search library that aims to perform well on large sites, while using as little of your users' bandwidth as possible.
+* [Hugo Lyra](https://github.com/paolomainardi/hugo-lyra). Hugo-Lyra is a JavaScript module to integrate [Lyra](https://github.com/LyraSearch/lyra) into a Hugo website. It contains the server-side part to generate the index and the client-side library (optional) to bootstrap the search engine easily.
## Commercial Search Services