Merge branch 'tempv0.121.0'

This commit is contained in:
Bjørn Erik Pedersen
2023-12-05 16:48:20 +01:00
5 changed files with 95 additions and 12 deletions
+3 -2
View File
@@ -24,8 +24,9 @@ Hugo comes with all the code you need to load Disqus into your templates. Before
Disqus comments require you set a single value in your [site's configuration file][configuration] like so:
{{< code-toggle file=hugo >}}
disqusShortname = "yourDisqusShortname"
{{< code-toggle file="hugo" >}}
[services.disqus]
shortname = 'your-disqus-shortname'
{{</ code-toggle >}}
For many websites, this is enough configuration. However, you also have the option to set the following in the [front matter] of a single content file:
@@ -0,0 +1,38 @@
---
title: transform.XMLEscape
description: Returns the given string, removing disallowed characters then escaping the result to its XML equivalent.
categories: []
keywords: []
action:
aliases: []
related: []
returnType: string
signatures: [transform.XMLEscape INPUT]
---
The `transform.XMLEscape` function removes [disallowed characters] as defined in the XML specification, then escapes the result by replacing the following characters with [HTML entities]:
- `"``&#34;`
- `'``&#39;`
- `&``&amp;`
- `<``&lt;`
- `>``&gt;`
- `\t``&#x9;`
- `\n``&#xA;`
- `\r``&#xD;`
For example:
```go-html-template
transform.XMLEscape "<p>abc</p>" → &lt;p&gt;abc&lt;/p&gt;
```
When using `transform.XMLEscape` in a template rendered by Go's [html/template] package, declare the string to be safe HTML to avoid double escaping. For example, in an RSS template:
{{< code file="layouts/_default/rss.xml" >}}
<description>{{ .Summary | transform.XMLEscape | safeHTML }}</description>
{{< /code >}}
[disallowed characters]: https://www.w3.org/TR/xml/#charsets
[html entities]: https://developer.mozilla.org/en-us/docs/glossary/entity
[html/template]: https://pkg.go.dev/html/template
+5 -5
View File
@@ -44,12 +44,12 @@ In addition to using a single site configuration file, one can use the `configDi
- Each file represents a configuration root object, such as `params.toml` for `[Params]`, `menu(s).toml` for `[Menu]`, `languages.toml` for `[Languages]` etc...
- Each file's content must be top-level, for example:
{{< code-toggle file=hugo >}}
{{< code-toggle file="hugo" copy=false >}}
[Params]
foo = "bar"
{{< /code-toggle >}}
{{< code-toggle file=params >}}
{{< code-toggle file="params" copy=false >}}
foo = "bar"
{{< /code-toggle >}}
@@ -78,7 +78,7 @@ Let's take an example to understand this better. Let's say you are using Google
[Google tag ID]: https://support.google.com/tagmanager/answer/12326985?hl=en
{{< code-toggle file=hugo >}}
{{< code-toggle file=hugo copy=false >}}
[services.googleAnalytics]
ID = 'G-XXXXXXXXX'
{{< /code-toggle >}}
@@ -103,7 +103,7 @@ To satisfy these requirements, configure your site as follows:
Include this section only:
{{< code-toggle file=hugo >}}
{{< code-toggle file=hugo copy=false >}}
[services.googleAnalytics]
ID = 'G-PPPPPPPPP'
{{< /code-toggle >}}
@@ -116,7 +116,7 @@ To satisfy these requirements, configure your site as follows:
Include this section only:
{{< code-toggle file=hugo >}}
{{< code-toggle file=hugo copy=false >}}
[services.googleAnalytics]
ID = 'G-SSSSSSSSS'
{{< /code-toggle >}}
+4 -3
View File
@@ -25,7 +25,8 @@ Hugo ships with an internal template supporting [Google Analytics 4].
Provide your tracking ID in your configuration file:
{{< code-toggle file=hugo >}}
**Google Analytics 4 (gtag.js)**
{{< code-toggle file="hugo" >}}
[services.googleAnalytics]
ID = "G-MEASUREMENT_ID"
{{</ code-toggle >}}
@@ -48,7 +49,7 @@ Hugo also ships with an internal template for [Disqus comments][disqus], a popul
To use Hugo's Disqus template, first set up a single configuration value:
{{< code-toggle file=hugo >}}
{{< code-toggle file="hugo" >}}
[services.disqus]
shortname = 'your-disqus-shortname'
{{</ code-toggle >}}
@@ -186,7 +187,7 @@ Hugo uses the page title and description for the card's title and description fi
Set the value of `twitter:site` in your site configuration:
{{< code-toggle file=hugo >}}
{{< code-toggle file="hugo" copy=false >}}
[params.social]
twitter = "GoHugoIO"
{{</ code-toggle >}}
+45 -2
View File
@@ -19,9 +19,15 @@ chroma:
- ada95
- ada2005
Name: Ada
- Aliases:
- agda
Name: Agda
- Aliases:
- al
Name: AL
- Aliases:
- alloy
Name: Alloy
- Aliases:
- ng2
Name: Angular2
@@ -198,6 +204,9 @@ chroma:
- Aliases:
- dart
Name: Dart
- Aliases:
- dax
Name: Dax
- Aliases:
- diff
- udiff
@@ -330,6 +339,9 @@ chroma:
- handlebars
- hbs
Name: Handlebars
- Aliases:
- hare
Name: Hare
- Aliases:
- haskell
- hs
@@ -501,6 +513,9 @@ chroma:
- obj-c
- objc
Name: Objective-C
- Aliases:
- objectpascal
Name: ObjectPascal
- Aliases:
- ocaml
Name: OCaml
@@ -824,6 +839,8 @@ chroma:
- Aliases:
- typoscripthtmldata
Name: TypoScriptHtmlData
- Aliases: null
Name: ucode
- Aliases:
- v
- vlang
@@ -1254,6 +1271,9 @@ config:
keepEndTags: true
keepQuotes: false
keepWhitespace: false
templateDelims:
- ""
- ""
js:
keepVarNames: false
precision: 0
@@ -1563,8 +1583,6 @@ config:
getenv:
- ^HUGO_
- ^CI$
goTemplates:
allowActionJSTmpl: false
http:
mediaTypes: null
methods:
@@ -2741,6 +2759,21 @@ tpl:
map[string]interface {}{
"Hugo": "Rocks!",
}
TestDeprecationErr:
Aliases: null
Args: null
Description: ""
Examples: null
TestDeprecationInfo:
Aliases: null
Args: null
Description: ""
Examples: null
TestDeprecationWarn:
Aliases: null
Args: null
Description: ""
Examples: null
Timer:
Aliases: null
Args: null
@@ -4364,6 +4397,16 @@ tpl:
- - '{{ "hello = \"Hello World\"" | resources.FromString "data/greetings.toml"
| transform.Unmarshal }}'
- map[hello:Hello World]
XMLEscape:
Aliases: null
Args:
- s
Description: |-
XMLEscape returns the given string, removing disallowed characters then
escaping the result to its XML equivalent.
Examples:
- - '{{ transform.XMLEscape "<p>abc</p>" }}'
- '&lt;p&gt;abc&lt;/p&gt;'
urls:
AbsLangURL:
Aliases: