Merge commit '5be51ac3db225d5df501ed1fa1499c41d97dbf65'

This commit is contained in:
Bjørn Erik Pedersen
2025-04-10 13:04:51 +02:00
987 changed files with 12379 additions and 14083 deletions

View File

@@ -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