hugo/docs/content/en/functions/urls/Anchorize.md
Bjørn Erik Pedersen 5fd1e74903
Merge commit '9b0050e9aabe4be65c78ccf292a348f309d50ccd' as 'docs'
```
git subtree add --prefix=docs/ https://github.com/gohugoio/hugoDocs.git master --squash
```

Closes #11925
2024-01-27 10:48:57 +01:00

1 KiB

title description categories keywords action aliases
urls.Anchorize Returns the given string, sanitized for usage in an HTML id attribute.
aliases related returnType signatures
anchorize
functions/urls/URLize
string
urls.Anchorize INPUT
/functions/anchorize

{{% include "/functions/urls/_common/anchorize-vs-urlize.md" %}}

Sanitizing logic

With the default markdown renderer, Goldmark, the sanitizing logic is controlled by your site configuration:

{{< code-toggle file=hugo >}} [markup.goldmark.parser] autoHeadingIDType = 'github' {{< /code-toggle >}}

This controls the behavior of the anchorize function and the generation of heading IDs when rendering markdown to HTML.

Set autoHeadingIDType to one of:

github
Compatible with GitHub. This is the default, and strongly recommended.
github-ascii
Similar to the "github" setting, but removes non-ASCII characters.
blackfriday
Provided for backwards compatibility with Hugo v0.59.1 and earlier. This option will be removed in a future release.