<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Safe functions on Hugo</title><link>https://v0-122-0--gohugoio.netlify.app/functions/safe/</link><description>Recent content in Safe functions on Hugo</description><generator>Hugo -- gohugo.io</generator><language>en</language><atom:link href="https://v0-122-0--gohugoio.netlify.app/functions/safe/index.xml" rel="self" type="application/rss+xml"/><item><title>safe.CSS</title><link>https://v0-122-0--gohugoio.netlify.app/functions/safe/css/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://v0-122-0--gohugoio.netlify.app/functions/safe/css/</guid><description>In this context, safe means CSS content that matches any of the following:
The CSS3 stylesheet production, such as p { color: purple }. The CSS3 rule production, such as a[href=~&amp;quot;https:&amp;quot;].foo#bar. CSS3 declaration productions, such as color: red; margin: 2px. The CSS3 value production, such as rgba(0, 0, 255, 127). Example: Given style = &amp;quot;color: red;&amp;quot; defined in the front matter of your .md file:
&amp;lt;p style=&amp;quot;{{ .Params.style | safeCSS }}&amp;quot;&amp;gt;…&amp;lt;/p&amp;gt; → &amp;lt;p style=&amp;quot;color: red;&amp;quot;&amp;gt;…&amp;lt;/p&amp;gt; &amp;lt;p style=&amp;quot;{{ .</description></item><item><title>safe.HTML</title><link>https://v0-122-0--gohugoio.netlify.app/functions/safe/html/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://v0-122-0--gohugoio.netlify.app/functions/safe/html/</guid><description>It should not be used for HTML from a third-party, or HTML with unclosed tags or comments.
Given a site-wide hugo.toml with the following copyright value:
hugo. yaml &amp;nbsp; toml &amp;nbsp; json &amp;nbsp; copyright: © 2015 Jane Doe. &amp;lt;a href=&amp;#34;https://creativecommons.org/licenses/by/4.0/&amp;#34;&amp;gt;Some rights reserved&amp;lt;/a&amp;gt;. copyright = &amp;#39;© 2015 Jane Doe. &amp;lt;a href=&amp;#34;https://creativecommons.org/licenses/by/4.0/&amp;#34;&amp;gt;Some rights reserved&amp;lt;/a&amp;gt;.&amp;#39; { &amp;#34;copyright&amp;#34;: &amp;#34;© 2015 Jane Doe. \u003ca href=\&amp;#34;https://creativecommons.org/licenses/by/4.0/\&amp;#34;\u003eSome rights reserved\u003c/a\u003e.&amp;#34; } {{ .Site.Copyright | safeHTML }} in a template would then output:</description></item><item><title>safe.HTMLAttr</title><link>https://v0-122-0--gohugoio.netlify.app/functions/safe/htmlattr/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://v0-122-0--gohugoio.netlify.app/functions/safe/htmlattr/</guid><description>Given a site configuration that contains this menu entry:
hugo. yaml &amp;nbsp; toml &amp;nbsp; json &amp;nbsp; menus: main: - name: IRC url: irc://irc.freenode.net/#golang [menus] [[menus.main]] name = &amp;#39;IRC&amp;#39; url = &amp;#39;irc://irc.freenode.net/#golang&amp;#39; { &amp;#34;menus&amp;#34;: { &amp;#34;main&amp;#34;: [ { &amp;#34;name&amp;#34;: &amp;#34;IRC&amp;#34;, &amp;#34;url&amp;#34;: &amp;#34;irc://irc.freenode.net/#golang&amp;#34; } ] } } Attempting to use the url value directly in an attribute:
{{ range site.Menus.main }} &amp;lt;a href=&amp;#34;{{ .URL }}&amp;#34;&amp;gt;{{ .Name }}&amp;lt;/a&amp;gt; {{ end }} Will produce:</description></item><item><title>safe.JS</title><link>https://v0-122-0--gohugoio.netlify.app/functions/safe/js/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://v0-122-0--gohugoio.netlify.app/functions/safe/js/</guid><description>In this context, safe means the string encapsulates a known safe EcmaScript5 Expression (e.g., (x + y * z())).
Template authors are responsible for ensuring that typed expressions do not break the intended precedence and that there is no statement/expression ambiguity as when passing an expression like { foo:bar() }\n['foo'](), which is both a valid expression and a valid program with a very different meaning.
Example: Given hash = &amp;quot;619c16f&amp;quot; defined in the front matter of your .</description></item><item><title>safe.JSStr</title><link>https://v0-122-0--gohugoio.netlify.app/functions/safe/jsstr/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://v0-122-0--gohugoio.netlify.app/functions/safe/jsstr/</guid><description>Encapsulates a sequence of characters meant to be embedded between quotes in a JavaScript expression. 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.
Without declaring a variable to be a safe JavaScript string:
{{ $title := &amp;#34;Lilo &amp;amp; Stitch&amp;#34; }} &amp;lt;script&amp;gt; const a = &amp;#34;Title: &amp;#34; + {{ $title }}; &amp;lt;/script&amp;gt; Rendered:</description></item><item><title>safe.URL</title><link>https://v0-122-0--gohugoio.netlify.app/functions/safe/url/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://v0-122-0--gohugoio.netlify.app/functions/safe/url/</guid><description>safeURL declares the provided string as a &amp;ldquo;safe&amp;rdquo; URL or URL substring (see RFC 3986). A URL like javascript:checkThatFormNotEditedBeforeLeavingPage() from a trusted source should go in the page, but by default dynamic javascript: URLs are filtered out since they are a frequently exploited injection vector.
Without safeURL, only the URI schemes http:, https: and mailto: are considered safe by Go templates. If any other URI schemes (e.g., irc: and javascript:) are detected, the whole URL will be replaced with #ZgotmplZ.</description></item></channel></rss>