summaryrefslogtreecommitdiffstats
path: root/docs/content/en/functions/safe
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2025-04-10 13:04:51 +0200
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2025-04-10 13:04:51 +0200
commit653f1c1d462332bccf303a5040e5cd99c89a4378 (patch)
treec993984f169a240567526e9993261241c0cda771 /docs/content/en/functions/safe
parent208a0de6c31354df6f9463d49e90db9dec935169 (diff)
parent5be51ac3db225d5df501ed1fa1499c41d97dbf65 (diff)
downloadhugo-653f1c1d462332bccf303a5040e5cd99c89a4378.tar.gz
hugo-653f1c1d462332bccf303a5040e5cd99c89a4378.zip
Merge commit '5be51ac3db225d5df501ed1fa1499c41d97dbf65'
Diffstat (limited to 'docs/content/en/functions/safe')
-rw-r--r--docs/content/en/functions/safe/CSS.md27
-rw-r--r--docs/content/en/functions/safe/HTML.md18
-rw-r--r--docs/content/en/functions/safe/HTMLAttr.md20
-rw-r--r--docs/content/en/functions/safe/JS.md18
-rw-r--r--docs/content/en/functions/safe/JSStr.md18
-rw-r--r--docs/content/en/functions/safe/URL.md27
-rw-r--r--docs/content/en/functions/safe/_index.md9
7 files changed, 46 insertions, 91 deletions
diff --git a/docs/content/en/functions/safe/CSS.md b/docs/content/en/functions/safe/CSS.md
index 5d67789b6..12ebbf8aa 100644
--- a/docs/content/en/functions/safe/CSS.md
+++ b/docs/content/en/functions/safe/CSS.md
@@ -3,23 +3,17 @@ title: safe.CSS
description: Declares the given string as a safe CSS string.
categories: []
keywords: []
-action:
- aliases: [safeCSS]
- related:
- - functions/safe/HTML
- - functions/safe/HTMLAttr
- - functions/safe/JS
- - functions/safe/JSStr
- - functions/safe/URL
- returnType: template.CSS
- signatures: [safe.CSS INPUT]
-toc: true
+params:
+ functions_and_methods:
+ aliases: [safeCSS]
+ returnType: template.CSS
+ signatures: [safe.CSS INPUT]
aliases: [/functions/safecss]
---
## Introduction
-{{% include "functions/_common/go-html-template-package.md" %}}
+{{% include "/_common/functions/go-html-template-package.md" %}}
## Usage
@@ -34,8 +28,6 @@ Use of this type presents a security risk: the encapsulated content should come
See the [Go documentation] for details.
-[Go documentation]: https://pkg.go.dev/html/template#CSS
-
## Example
Without a safe declaration:
@@ -51,9 +43,8 @@ Hugo renders the above to:
<p style="ZgotmplZ">foo</p>
```
-{{% note %}}
-`ZgotmplZ` is a special value that indicates that unsafe content reached a CSS or URL context at runtime.
-{{% /note %}}
+> [!note]
+> `ZgotmplZ` is a special value that indicates that unsafe content reached a CSS or URL context at runtime.
To declare the string as safe:
@@ -67,3 +58,5 @@ Hugo renders the above to:
```html
<p style="color: red;">foo</p>
```
+
+[Go documentation]: https://pkg.go.dev/html/template#CSS
diff --git a/docs/content/en/functions/safe/HTML.md b/docs/content/en/functions/safe/HTML.md
index ad1b3a681..25ffb3318 100644
--- a/docs/content/en/functions/safe/HTML.md
+++ b/docs/content/en/functions/safe/HTML.md
@@ -3,23 +3,17 @@ title: safe.HTML
description: Declares the given string as a safeHTML string.
categories: []
keywords: []
-action:
- aliases: [safeHTML]
- related:
- - functions/safe/CSS
- - functions/safe/HTMLAttr
- - functions/safe/JS
- - functions/safe/JSStr
- - functions/safe/URL
- returnType: template.HTML
- signatures: [safe.HTML INPUT]
-toc: true
+params:
+ functions_and_methods:
+ aliases: [safeHTML]
+ returnType: template.HTML
+ signatures: [safe.HTML INPUT]
aliases: [/functions/safehtml]
---
## Introduction
-{{% include "functions/_common/go-html-template-package.md" %}}
+{{% include "/_common/functions/go-html-template-package.md" %}}
## Usage
diff --git a/docs/content/en/functions/safe/HTMLAttr.md b/docs/content/en/functions/safe/HTMLAttr.md
index d01a3908a..7cfefdfb2 100644
--- a/docs/content/en/functions/safe/HTMLAttr.md
+++ b/docs/content/en/functions/safe/HTMLAttr.md
@@ -3,28 +3,22 @@ title: safe.HTMLAttr
description: Declares the given key-value pair as a safe HTML attribute.
categories: []
keywords: []
-action:
- aliases: [safeHTMLAttr]
- related:
- - functions/safe/CSS
- - functions/safe/HTML
- - functions/safe/JS
- - functions/safe/JSStr
- - functions/safe/URL
- returnType: template.HTMLAttr
- signatures: [safe.HTMLAttr INPUT]
-toc: true
+params:
+ functions_and_methods:
+ aliases: [safeHTMLAttr]
+ returnType: template.HTMLAttr
+ signatures: [safe.HTMLAttr INPUT]
aliases: [/functions/safehtmlattr]
---
## Introduction
-{{% include "functions/_common/go-html-template-package.md" %}}
+{{% include "/_common/functions/go-html-template-package.md" %}}
## Usage
Use the `safe.HTMLAttr` function to encapsulate an HTML attribute from a trusted source.
-
+
Use of this type presents a security risk: the encapsulated content should come from a trusted source, as it will be included verbatim in the template output.
See the [Go documentation] for details.
diff --git a/docs/content/en/functions/safe/JS.md b/docs/content/en/functions/safe/JS.md
index d0d3a227a..0c4d9009d 100644
--- a/docs/content/en/functions/safe/JS.md
+++ b/docs/content/en/functions/safe/JS.md
@@ -3,23 +3,17 @@ title: safe.JS
description: Declares the given string as a safe JavaScript expression.
categories: []
keywords: []
-action:
- aliases: [safeJS]
- related:
- - functions/safe/CSS
- - functions/safe/HTML
- - functions/safe/HTMLAttr
- - functions/safe/JSStr
- - functions/safe/URL
- returnType: template.JS
- signatures: [safe.JS INPUT]
-toc: true
+params:
+ functions_and_methods:
+ aliases: [safeJS]
+ returnType: template.JS
+ signatures: [safe.JS INPUT]
aliases: [/functions/safejs]
---
## Introduction
-{{% include "functions/_common/go-html-template-package.md" %}}
+{{% include "/_common/functions/go-html-template-package.md" %}}
## Usage
diff --git a/docs/content/en/functions/safe/JSStr.md b/docs/content/en/functions/safe/JSStr.md
index e7e232d1b..81946a14c 100644
--- a/docs/content/en/functions/safe/JSStr.md
+++ b/docs/content/en/functions/safe/JSStr.md
@@ -3,23 +3,17 @@ title: safe.JSStr
description: Declares the given string as a safe JavaScript string.
categories: []
keywords: []
-action:
- aliases: [safeJSStr]
- related:
- - functions/safe/CSS
- - functions/safe/HTML
- - functions/safe/HTMLAttr
- - functions/safe/JS
- - functions/safe/URL
- returnType: template.JSStr
- signatures: [safe.JSStr INPUT]
-toc: true
+params:
+ functions_and_methods:
+ aliases: [safeJSStr]
+ returnType: template.JSStr
+ signatures: [safe.JSStr INPUT]
aliases: [/functions/safejsstr]
---
## Introduction
-{{% include "functions/_common/go-html-template-package.md" %}}
+{{% include "/_common/functions/go-html-template-package.md" %}}
## Usage
diff --git a/docs/content/en/functions/safe/URL.md b/docs/content/en/functions/safe/URL.md
index e4b3224da..44bed8064 100644
--- a/docs/content/en/functions/safe/URL.md
+++ b/docs/content/en/functions/safe/URL.md
@@ -3,23 +3,17 @@ title: safe.URL
description: Declares the given string as a safe URL or URL substring.
categories: []
keywords: []
-action:
- aliases: [safeURL]
- related:
- - functions/safe/CSS
- - functions/safe/HTML
- - functions/safe/HTMLAttr
- - functions/safe/JS
- - functions/safe/JSStr
- returnType: template.URL
- signatures: [safe.URL INPUT]
-toc: true
+params:
+ functions_and_methods:
+ aliases: [safeURL]
+ returnType: template.URL
+ signatures: [safe.URL INPUT]
aliases: [/functions/safeurl]
---
## Introduction
-{{% include "functions/_common/go-html-template-package.md" %}}
+{{% include "/_common/functions/go-html-template-package.md" %}}
## Usage
@@ -33,8 +27,6 @@ Use of this type presents a security risk: the encapsulated content should come
See the [Go documentation] for details.
-[Go documentation]: https://pkg.go.dev/html/template#URL
-
## Example
Without a safe declaration:
@@ -50,9 +42,8 @@ Hugo renders the above to:
<a href="#ZgotmplZ">IRC</a>
```
-{{% note %}}
-`ZgotmplZ` is a special value that indicates that unsafe content reached a CSS or URL context at runtime.
-{{% /note %}}
+> [!note]
+> `ZgotmplZ` is a special value that indicates that unsafe content reached a CSS or URL context at runtime.
To declare the string as safe:
@@ -66,3 +57,5 @@ Hugo renders the above to:
```html
<a href="irc://irc.freenode.net/#golang">IRC</a>
```
+
+[Go documentation]: https://pkg.go.dev/html/template#URL
diff --git a/docs/content/en/functions/safe/_index.md b/docs/content/en/functions/safe/_index.md
index f80a2cff4..8d5697b8d 100644
--- a/docs/content/en/functions/safe/_index.md
+++ b/docs/content/en/functions/safe/_index.md
@@ -1,14 +1,7 @@
---
title: Safe functions
linkTitle: safe
-description: Template functions to declare a value as safe in the context of Go's html/template package.
+description: Use these functions to declare a value as safe in the context of Go's html/template package.
categories: []
keywords: []
-menu:
- docs:
- parent: functions
---
-
-Use these functions to declare a value as safe in the context of Go's [html/template] package.
-
-[html/template]: https://pkg.go.dev/html/template