2&&D>2&&!e.hidden?(W=p,X=0):W=D>1&&X>1&&Q<6?d:0),f!==c&&($=innerWidth+c*g,M=innerHeight+c,l=-1*c,f=c),s=m[n].getBoundingClientRect(),(B=s.bottom)>=l&&(H=s.top)<=M&&(z=s.right)>=l*g&&(F=s.left)<=$&&(B||z||F||H)&&(i.loadHidden||Z(m[n]))&&(R&&Q<3&&!h&&(D<3||X<4)||Y(m[n],c))){if(at(m[n]),u=!0,Q>9)break}else!u&&R&&!a&&Q<4&&X<4&&D>2&&(L[0]||i.preloadAfterLoad)&&(L[0]||!h&&(B||z||F||H||"auto"!=m[n].getAttribute(i.sizesAttr)))&&(a=L[0]||m[n]);a&&!u&&at(a)}},et=function(t){var e,r=0,o=i.throttleDelay,s=i.ricTimeout,a=function(){e=!1,r=n.now(),t()},c=l&&s>49?function(){l(a,{timeout:s}),s!==i.ricTimeout&&(s=i.ricTimeout)}:C((function(){u(a)}),!0);return function(t){var i;(t=!0===t)&&(s=33),e||(e=!0,(i=o-(n.now()-r))<0&&(i=0),t||i<9?c():u(c,i))}}(tt),nt=function(t){var e=t.target;e._lazyCache?delete e._lazyCache:(G(t),m(e,i.loadedClass),y(e,i.loadingClass),v(e,it),b(e,"lazyloaded"))},rt=C(nt),it=function(t){rt({target:t.target})},ot=function(t){var e,n=t.getAttribute(i.srcsetAttr);(e=i.customMedia[t.getAttribute("data-media")||t.getAttribute("media")])&&t.setAttribute("media",e),n&&t.setAttribute("srcset",n)},st=C((function(t,e,n,r,o){var s,a,c,l,f,d;(f=b(t,"lazybeforeunveil",e)).defaultPrevented||(r&&(n?m(t,i.autosizesClass):t.setAttribute("sizes",r)),a=t.getAttribute(i.srcsetAttr),s=t.getAttribute(i.srcAttr),o&&(l=(c=t.parentNode)&&h.test(c.nodeName||"")),d=e.firesLoad||"src"in t&&(a||s||l),f={target:t},m(t,i.loadingClass),d&&(clearTimeout(P),P=u(G,2500),v(t,it,!0)),l&&p.call(c.getElementsByTagName("source"),ot),a?t.setAttribute("srcset",a):s&&!l&&(K.test(t.nodeName)?function(t,e){var n=t.getAttribute("data-load-mode")||i.iframeLoadMode;0==n?t.contentWindow.location.replace(e):1==n&&(t.src=e)}(t,s):t.src=s),o&&(a||l)&&w(t,{src:s})),t._lazyRace&&delete t._lazyRace,y(t,i.lazyClass),S((function(){var e=t.complete&&t.naturalWidth>1;d&&!e||(e&&m(t,i.fastLoadedClass),nt(f),t._lazyCache=!0,u((function(){"_lazyCache"in t&&delete t._lazyCache}),9)),"lazy"==t.loading&&Q--}),!0)})),at=function(t){if(!t._lazyRace){var e,n=V.test(t.nodeName),r=n&&(t.getAttribute(i.sizesAttr)||t.getAttribute("sizes")),o="auto"==r;(!o&&R||!n||!t.getAttribute("src")&&!t.srcset||t.complete||g(t,i.errorClass)||!g(t,i.lazyClass))&&(e=b(t,"lazyunveilread").detail,o&&T.updateElem(t,!0,t.offsetWidth),t._lazyRace=!0,Q++,st(t,e,o,r,n))}},ut=A((function(){i.loadMode=3,et()})),ct=function(){3==i.loadMode&&(i.loadMode=2),ut()},lt=function(){R||(n.now()-q<999?u(lt,999):(R=!0,i.loadMode=3,et(),a("scroll",ct,!0)))},{_:function(){q=n.now(),r.elements=e.getElementsByClassName(i.lazyClass),L=e.getElementsByClassName(i.lazyClass+" "+i.preloadClass),a("scroll",et,!0),a("resize",et,!0),a("pageshow",(function(t){if(t.persisted){var n=e.querySelectorAll("."+i.loadingClass);n.length&&n.forEach&&c((function(){n.forEach((function(t){t.complete&&at(t)}))}))}})),t.MutationObserver?new MutationObserver(et).observe(o,{childList:!0,subtree:!0,attributes:!0}):(o.addEventListener("DOMNodeInserted",et,!0),o.addEventListener("DOMAttrModified",et,!0),setInterval(et,999)),a("hashchange",et,!0),["focus","mouseover","click","load","transitionend","animationend"].forEach((function(t){e.addEventListener(t,et,!0)})),/d$|^c/.test(e.readyState)?lt():(a("load",lt),e.addEventListener("DOMContentLoaded",et),u(lt,2e4)),r.elements.length?(tt(),S._lsFlush()):et()},checkElems:et,unveil:at,_aLSL:ct}),T=(N=C((function(t,e,n,r){var i,o,s;if(t._lazysizesWidth=r,r+="px",t.setAttribute("sizes",r),h.test(e.nodeName||""))for(o=0,s=(i=e.getElementsByTagName("source")).length;o1&&void 0!==arguments[1]?arguments[1]:{container:document.body},n="";return"string"==typeof t?n=h(t,e):t instanceof HTMLInputElement&&!["text","search","url","tel","password"].includes(null==t?void 0:t.type)?n=h(t.value,e):(n=u()(t),c("copy")),n};function p(t){return(p="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var d=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.action,n=void 0===e?"copy":e,r=t.container,i=t.target,o=t.text;if("copy"!==n&&"cut"!==n)throw new Error('Invalid "action" value, use either "copy" or "cut"');if(void 0!==i){if(!i||"object"!==p(i)||1!==i.nodeType)throw new Error('Invalid "target" value, use a valid Element');if("copy"===n&&i.hasAttribute("disabled"))throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');if("cut"===n&&(i.hasAttribute("readonly")||i.hasAttribute("disabled")))throw new Error('Invalid "target" attribute. You can\'t cut text from elements with "readonly" or "disabled" attributes')}return o?f(o,{container:r}):i?"cut"===n?l(i):f(i,{container:r}):void 0};function g(t){return(g="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function m(t,e){for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:{container:document.body};return f(t,e)}},{key:"cut",value:function(t){return l(t)}},{key:"isSupported",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:["copy","cut"],e="string"==typeof t?[t]:t,n=!!document.queryCommandSupported;return e.forEach((function(t){n=n&&!!document.queryCommandSupported(t)})),n}}],(n=[{key:"resolveOptions",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.action="function"==typeof t.action?t.action:this.defaultAction,this.target="function"==typeof t.target?t.target:this.defaultTarget,this.text="function"==typeof t.text?t.text:this.defaultText,this.container="object"===g(t.container)?t.container:document.body}},{key:"listenClick",value:function(t){var e=this;this.listener=s()(t,"click",(function(t){return e.onClick(t)}))}},{key:"onClick",value:function(t){var e=t.delegateTarget||t.currentTarget,n=this.action(e)||"copy",r=d({action:n,container:this.container,target:this.target(e),text:this.text(e)});this.emit(r?"success":"error",{action:n,text:r,trigger:e,clearSelection:function(){e&&e.focus(),window.getSelection().removeAllRanges()}})}},{key:"defaultAction",value:function(t){return _("action",t)}},{key:"defaultTarget",value:function(t){var e=_("target",t);if(e)return document.querySelector(e)}},{key:"defaultText",value:function(t){return _("text",t)}},{key:"destroy",value:function(){this.listener.destroy()}}])&&m(e.prototype,n),r&&m(e,r),o}(i())},828:function(t){if("undefined"!=typeof Element&&!Element.prototype.matches){var e=Element.prototype;e.matches=e.matchesSelector||e.mozMatchesSelector||e.msMatchesSelector||e.oMatchesSelector||e.webkitMatchesSelector}t.exports=function(t,e){for(;t&&9!==t.nodeType;){if("function"==typeof t.matches&&t.matches(e))return t;t=t.parentNode}}},438:function(t,e,n){var r=n(828);function i(t,e,n,r,i){var s=o.apply(this,arguments);return t.addEventListener(n,s,i),{destroy:function(){t.removeEventListener(n,s,i)}}}function o(t,e,n,i){return function(n){n.delegateTarget=r(n.target,e),n.delegateTarget&&i.call(t,n)}}t.exports=function(t,e,n,r,o){return"function"==typeof t.addEventListener?i.apply(null,arguments):"function"==typeof n?i.bind(null,document).apply(null,arguments):("string"==typeof t&&(t=document.querySelectorAll(t)),Array.prototype.map.call(t,(function(t){return i(t,e,n,r,o)})))}},879:function(t,e){e.node=function(t){return void 0!==t&&t instanceof HTMLElement&&1===t.nodeType},e.nodeList=function(t){var n=Object.prototype.toString.call(t);return void 0!==t&&("[object NodeList]"===n||"[object HTMLCollection]"===n)&&"length"in t&&(0===t.length||e.node(t[0]))},e.string=function(t){return"string"==typeof t||t instanceof String},e.fn=function(t){return"[object Function]"===Object.prototype.toString.call(t)}},370:function(t,e,n){var r=n(879),i=n(438);t.exports=function(t,e,n){if(!t&&!e&&!n)throw new Error("Missing required arguments");if(!r.string(e))throw new TypeError("Second argument must be a String");if(!r.fn(n))throw new TypeError("Third argument must be a Function");if(r.node(t))return function(t,e,n){return t.addEventListener(e,n),{destroy:function(){t.removeEventListener(e,n)}}}(t,e,n);if(r.nodeList(t))return function(t,e,n){return Array.prototype.forEach.call(t,(function(t){t.addEventListener(e,n)})),{destroy:function(){Array.prototype.forEach.call(t,(function(t){t.removeEventListener(e,n)}))}}}(t,e,n);if(r.string(t))return function(t,e,n){return i(document.body,t,e,n)}(t,e,n);throw new TypeError("First argument must be a String, HTMLElement, HTMLCollection, or NodeList")}},817:function(t){t.exports=function(t){var e;if("SELECT"===t.nodeName)t.focus(),e=t.value;else if("INPUT"===t.nodeName||"TEXTAREA"===t.nodeName){var n=t.hasAttribute("readonly");n||t.setAttribute("readonly",""),t.select(),t.setSelectionRange(0,t.value.length),n||t.removeAttribute("readonly"),e=t.value}else{t.hasAttribute("contenteditable")&&t.focus();var r=window.getSelection(),i=document.createRange();i.selectNodeContents(t),r.removeAllRanges(),r.addRange(i),e=r.toString()}return e}},279:function(t){function e(){}e.prototype={on:function(t,e,n){var r=this.e||(this.e={});return(r[t]||(r[t]=[])).push({fn:e,ctx:n}),this},once:function(t,e,n){var r=this;function i(){r.off(t,i),e.apply(n,arguments)}return i._=e,this.on(t,i,n)},emit:function(t){for(var e=[].slice.call(arguments,1),n=((this.e||(this.e={}))[t]||[]).slice(),r=0,i=n.length;r";var r=document.createElement("div");r.appendChild(document.createTextNode(e)),n=n||"";var i=document.createElement("div");i.appendChild(document.createTextNode(n));var s=document.createElement("div");return s.appendChild(document.createTextNode(t)),s.innerHTML.replace(RegExp(o(r.innerHTML),"g"),e).replace(RegExp(o(i.innerHTML),"g"),n)}}},function(t,e,n){"use strict";t.exports={element:null}},function(t,e){var n=Object.prototype.hasOwnProperty,r=Object.prototype.toString;t.exports=function(t,e,i){if("[object Function]"!==r.call(e))throw new TypeError("iterator must be a function");var o=t.length;if(o===+o)for(var s=0;s was loaded but did not call our provided callback"),JSONPScriptError:o("JSONPScriptError","
+```
+
+Rendered:
+
+
+```html
+
+```
+
+To avoid escaping by Go's [html/template] package:
+
+```go-html-template
+{{ $title := "Lilo & Stitch" }}
+
+```
+
+Rendered:
+
+```html
+
+```
+
+[html/template]: https://pkg.go.dev/html/template
diff --git a/docs/content/en/functions/safeURL.md b/docs/content/en/functions/safe/URL.md
similarity index 89%
rename from docs/content/en/functions/safeURL.md
rename to docs/content/en/functions/safe/URL.md
index b21de4953be..edc62ff9dbe 100644
--- a/docs/content/en/functions/safeURL.md
+++ b/docs/content/en/functions/safe/URL.md
@@ -1,13 +1,24 @@
---
-title: safeURL
+title: safe.URL
+linkTitle: safeURL
description: Declares the provided string as a safe URL or URL substring.
-keywords: [strings,urls]
categories: [functions]
+keywords: []
menu:
docs:
parent: functions
-signature: ["safeURL INPUT"]
-relatedfuncs: []
+function:
+ aliases: [safeURL]
+ returnType: template.URL
+ signatures: [safe.URL INPUT]
+relatedFunctions:
+ - safe.CSS
+ - safe.HTML
+ - safe.HTMLAttr
+ - safe.JS
+ - safe.JSStr
+ - safe.URL
+aliases: [/functions/safeurl]
---
`safeURL` declares the provided string as a "safe" 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.
diff --git a/docs/content/en/functions/sha.md b/docs/content/en/functions/sha.md
deleted file mode 100644
index 1f6cf8da0aa..00000000000
--- a/docs/content/en/functions/sha.md
+++ /dev/null
@@ -1,26 +0,0 @@
----
-title: sha
-description: Hashes the given input and returns either an SHA1 or SHA256 checksum.
-categories: [functions]
-menu:
- docs:
- parent: functions
-keywords: [sha,checksum]
-signature: ["sha1 INPUT", "sha256 INPUT"]
-relatedfuncs: [md5]
-aliases: [sha1, sha256]
----
-
-`sha1` hashes the given input and returns its SHA1 checksum.
-
-```go-html-template
-{{ sha1 "Hello world, gophers!" }}
-
-```
-
-`sha256` hashes the given input and returns its SHA256 checksum.
-
-```go-html-template
-{{ sha256 "Hello world, gophers!" }}
-
-```
diff --git a/docs/content/en/functions/singularize.md b/docs/content/en/functions/singularize.md
deleted file mode 100644
index 4e56684b906..00000000000
--- a/docs/content/en/functions/singularize.md
+++ /dev/null
@@ -1,15 +0,0 @@
----
-title: singularize
-description: Converts a word according to a set of common English singularization rules.
-categories: [functions]
-menu:
- docs:
- parent: functions
-keywords: [strings,singular]
-signature: ["singularize INPUT"]
-relatedfuncs: []
----
-
-`{{ "cats" | singularize }}` → "cat"
-
-See also the `.Data.Singular` [taxonomy variable](/variables/taxonomy/) for singularizing taxonomy names.
diff --git a/docs/content/en/functions/site.md b/docs/content/en/functions/site.md
deleted file mode 100644
index b408f7141f8..00000000000
--- a/docs/content/en/functions/site.md
+++ /dev/null
@@ -1,14 +0,0 @@
----
-title: site
-description: The `site` function provides global access to the same data as the `.Site` page method.
-keywords: []
-categories: [functions]
-menu:
- docs:
- parent: functions
-toc:
-signature: ["site"]
-relatedfuncs: ["hugo"]
----
-
-`site` is a global function which returns the same data as the `.Site` page method. See: [Site Variables](/variables/site).
diff --git a/docs/content/en/functions/site/index.md b/docs/content/en/functions/site/index.md
new file mode 100644
index 00000000000..3341bff9844
--- /dev/null
+++ b/docs/content/en/functions/site/index.md
@@ -0,0 +1,35 @@
+---
+title: site
+description: Provides global access to the .Site object.
+categories: [functions]
+keywords: []
+menu:
+ docs:
+ parent: functions
+function:
+ aliases: []
+ returnType:
+ signatures: [site]
+relatedFunctions:
+ - hugo
+ - page
+ - site
+aliases: [/functions/site]
+---
+
+At the top level of a template that receives the `Site` object in context, these are equivalent:
+
+```go-html-template
+{{ .Site.Params.foo }}
+{{ site.Params.foo }}
+```
+
+When the `Site` object is not in context, use the global `site` function:
+
+```go-html-template
+{{ site.Params.foo }}
+```
+
+{{% note %}}
+To simplify your templates, use the global `site` function regardless of whether the `Site` object is in context.
+{{% /note %}}
diff --git a/docs/content/en/functions/slice.md b/docs/content/en/functions/slice.md
deleted file mode 100644
index d2ef6286193..00000000000
--- a/docs/content/en/functions/slice.md
+++ /dev/null
@@ -1,23 +0,0 @@
----
-title: slice
-description: Creates a slice (array) of all passed arguments.
-categories: [functions]
-menu:
- docs:
- parent: functions
-keywords: [slice, array, interface]
-signature: ["slice ITEM..."]
-relatedfuncs: []
----
-
-One use case is the concatenation of elements in combination with the [`delimit` function]:
-
-{{< code file="slice.html" >}}
-{{ $sliceOfStrings := slice "foo" "bar" "buzz" }}
-
-{{ delimit ($sliceOfStrings) ", " }}
-
-{{< /code >}}
-
-
-[`delimit` function]: /functions/delimit/
diff --git a/docs/content/en/functions/slicestr.md b/docs/content/en/functions/slicestr.md
deleted file mode 100644
index bbdf956969a..00000000000
--- a/docs/content/en/functions/slicestr.md
+++ /dev/null
@@ -1,19 +0,0 @@
----
-title: slicestr
-description: Creates a slice of a half-open range, including start and end indices.
-categories: [functions]
-menu:
- docs:
- parent: functions
-keywords: [strings]
-signature:
- - "slicestr STRING START [END]"
- - "strings.SliceString STRING START [END]"
-relatedfuncs: []
----
-
-For example, 1 and 4 creates a slice including elements 1 through 3.
-The `end` index can be omitted; it defaults to the string's length.
-
-* `{{ slicestr "BatMan" 3 }}` → "Man"
-* `{{ slicestr "BatMan" 0 3 }}` → "Bat"
diff --git a/docs/content/en/functions/split.md b/docs/content/en/functions/split.md
deleted file mode 100644
index d2f3cc8b33a..00000000000
--- a/docs/content/en/functions/split.md
+++ /dev/null
@@ -1,23 +0,0 @@
----
-title: split
-description: Returns a slice of strings by splitting STRING by DELIM.
-categories: [functions]
-menu:
- docs:
- parent: functions
-keywords: [strings]
-signature: ["split STRING DELIM"]
-relatedfuncs: []
----
-
-Examples:
-
-```go-html-template
-{{ split "tag1,tag2,tag3" "," }} → ["tag1", "tag2", "tag3"]
-{{ split "abc" "" }} → ["a", "b", "c"]
-```
-
-
-{{% note %}}
-`split` essentially does the opposite of [delimit](/functions/delimit). While `split` creates a slice from a string, `delimit` creates a string from a slice.
-{{% /note %}}
diff --git a/docs/content/en/functions/strings.Contains.md b/docs/content/en/functions/strings.Contains.md
deleted file mode 100644
index 44cb73b8143..00000000000
--- a/docs/content/en/functions/strings.Contains.md
+++ /dev/null
@@ -1,17 +0,0 @@
----
-title: strings.Contains
-description: Reports whether a string contains a substring.
-categories: [functions]
-menu:
- docs:
- parent: functions
-keywords: [string strings substring contains]
-signature: ["strings.Contains STRING SUBSTRING"]
-relatedfuncs: [strings.ContainsAny]
----
-
- {{ strings.Contains "Hugo" "go" }} → true
-
-The check is case sensitive:
-
- {{ strings.Contains "Hugo" "Go" }} → false
diff --git a/docs/content/en/functions/strings.ContainsAny.md b/docs/content/en/functions/strings.ContainsAny.md
deleted file mode 100644
index 36fa8701be0..00000000000
--- a/docs/content/en/functions/strings.ContainsAny.md
+++ /dev/null
@@ -1,17 +0,0 @@
----
-title: strings.ContainsAny
-description: Reports whether a string contains any character from a given string.
-categories: [functions]
-menu:
- docs:
- parent: functions
-keywords: [string strings substring contains any]
-signature: ["strings.ContainsAny STRING CHARACTERS"]
-relatedfuncs: [strings.Contains]
----
-
- {{ strings.ContainsAny "Hugo" "gm" }} → true
-
-The check is case sensitive:
-
- {{ strings.ContainsAny "Hugo" "Gm" }} → false
diff --git a/docs/content/en/functions/strings.Count.md b/docs/content/en/functions/strings.Count.md
deleted file mode 100644
index 7c394569307..00000000000
--- a/docs/content/en/functions/strings.Count.md
+++ /dev/null
@@ -1,20 +0,0 @@
----
-title: strings.Count
-description: Returns the number of non-overlapping instances of a substring within a string.
-categories: [functions]
-menu:
- docs:
- parent: functions
-keywords: [count, counting, character count]
-signature: ["strings.Count SUBSTR STRING"]
-relatedfuncs: []
----
-
-If `SUBSTR` is an empty string, this function returns 1 plus the number of Unicode code points in `STRING`.
-
-Example|Result
-:--|:--
-`{{ "aaabaab" \| strings.Count "a" }}`|5
-`{{ "aaabaab" \| strings.Count "aa" }}`|2
-`{{ "aaabaab" \| strings.Count "aaa" }}`|1
-`{{ "aaabaab" \| strings.Count "" }}`|8
diff --git a/docs/content/en/functions/strings.FirstUpper.md b/docs/content/en/functions/strings.FirstUpper.md
deleted file mode 100644
index fab82a2dc63..00000000000
--- a/docs/content/en/functions/strings.FirstUpper.md
+++ /dev/null
@@ -1,12 +0,0 @@
----
-title: strings.FirstUpper
-description: Capitalizes the first character of a given string.
-categories: [functions]
-menu:
- docs:
- parent: functions
-keywords: [strings capitalize uppercase first]
-signature: ["strings.FirstUpper STRING"]
----
-
- {{ strings.FirstUpper "foo" }} → "Foo"
diff --git a/docs/content/en/functions/strings.HasPrefix.md b/docs/content/en/functions/strings.HasPrefix.md
deleted file mode 100644
index 70317a4c19c..00000000000
--- a/docs/content/en/functions/strings.HasPrefix.md
+++ /dev/null
@@ -1,16 +0,0 @@
----
-title: strings.HasPrefix
-description: Tests whether a string begins with prefix.
-categories: [functions]
-menu:
- docs:
- parent: functions
-keywords: [strings]
-signature: ["hasPrefix STRING PREFIX","strings.HasPrefix STRING PREFIX"]
-relatedfuncs: [hasSuffix]
-aliases: [/functions/hasprefix/]
----
-
-```go-html-template
-{{ hasPrefix "Hugo" "Hu" }} → true
-```
diff --git a/docs/content/en/functions/strings.HasSuffix.md b/docs/content/en/functions/strings.HasSuffix.md
deleted file mode 100644
index 3ead121a333..00000000000
--- a/docs/content/en/functions/strings.HasSuffix.md
+++ /dev/null
@@ -1,16 +0,0 @@
----
-title: strings.HasSuffix
-description: Tests whether a string ends with suffix.
-categories: [functions]
-menu:
- docs:
- parent: functions
-keywords: [strings]
-signature: ["hasSuffix STRING SUFFIX","strings.HasSuffix STRING SUFFIX"]
-relatedfuncs: [hasPrefix]
-aliases: [/functions/hassuffix/]
----
-
-```go-html-template
-{{ hasSuffix "Hugo" "go" }} → true
-```
diff --git a/docs/content/en/functions/strings.Repeat.md b/docs/content/en/functions/strings.Repeat.md
deleted file mode 100644
index 99b2fe5a5e9..00000000000
--- a/docs/content/en/functions/strings.Repeat.md
+++ /dev/null
@@ -1,16 +0,0 @@
----
-title: strings.Repeat
-description: Returns INPUT repeated COUNT times.
-categories: [functions]
-menu:
- docs:
- parent: functions
-keywords: [strings]
-signature: ["strings.Repeat COUNT INPUT"]
-relatedfuncs: []
----
-
-```go-html-template
-{{ strings.Repeat 3 "yo" }} → "yoyoyo"
-{{ "yo" | strings.Repeat 3 }} → "yoyoyo"
-```
diff --git a/docs/content/en/functions/strings.RuneCount.md b/docs/content/en/functions/strings.RuneCount.md
deleted file mode 100644
index 3a72e339a3b..00000000000
--- a/docs/content/en/functions/strings.RuneCount.md
+++ /dev/null
@@ -1,20 +0,0 @@
----
-title: strings.RuneCount
-description: Determines the number of runes in a string.
-categories: [functions]
-menu:
- docs:
- parent: functions
-keywords: [counting, character count, length, rune length, rune count]
-signature: ["strings.RuneCount INPUT"]
-relatedfuncs: ["len", "countrunes"]
----
-
-In contrast with `strings.CountRunes` function, which strips HTML and whitespace before counting runes, `strings.RuneCount` simply counts all the runes in a string. It relies on the Go [`utf8.RuneCountInString`] function.
-
-```go-html-template
-{{ "Hello, 世界" | strings.RuneCount }}
-
-```
-
-[`utf8.RuneCount`]: https://golang.org/pkg/unicode/utf8/#RuneCount
diff --git a/docs/content/en/functions/strings.TrimLeft.md b/docs/content/en/functions/strings.TrimLeft.md
deleted file mode 100644
index b0271c8a852..00000000000
--- a/docs/content/en/functions/strings.TrimLeft.md
+++ /dev/null
@@ -1,19 +0,0 @@
----
-title: strings.TrimLeft
-description: Returns a slice of a given string with all leading characters contained in the cutset removed.
-categories: [functions]
-menu:
- docs:
- parent: functions
-keywords: [strings]
-signature: ["strings.TrimLeft CUTSET STRING"]
-relatedfuncs: [strings.TrimRight]
----
-
-Given the string `"abba"`, leading `"a"`'s can be removed a follows:
-
- {{ strings.TrimLeft "a" "abba" }} → "bba"
-
-Numbers can be handled as well:
-
- {{ strings.TrimLeft 12 1221341221 }} → "341221"
diff --git a/docs/content/en/functions/strings.TrimPrefix.md b/docs/content/en/functions/strings.TrimPrefix.md
deleted file mode 100644
index c3f7029610a..00000000000
--- a/docs/content/en/functions/strings.TrimPrefix.md
+++ /dev/null
@@ -1,17 +0,0 @@
----
-title: strings.TrimPrefix
-description: Returns a given string s without the provided leading prefix string. If s doesn't start with prefix, s is returned unchanged.
-categories: [functions]
-menu:
- docs:
- parent: functions
-keywords: [strings]
-signature: ["strings.TrimPrefix PREFIX STRING"]
-relatedfuncs: [strings.TrimSuffix]
----
-
-Given the string `"aabbaa"`, the specified prefix is only removed if `"aabbaa"` starts with it:
-
- {{ strings.TrimPrefix "a" "aabbaa" }} → "abbaa"
- {{ strings.TrimPrefix "aa" "aabbaa" }} → "bbaa"
- {{ strings.TrimPrefix "aaa" "aabbaa" }} → "aabbaa"
diff --git a/docs/content/en/functions/strings.TrimRight.md b/docs/content/en/functions/strings.TrimRight.md
deleted file mode 100644
index e61b884cd45..00000000000
--- a/docs/content/en/functions/strings.TrimRight.md
+++ /dev/null
@@ -1,19 +0,0 @@
----
-title: strings.TrimRight
-description: Returns a slice of a given string with all trailing characters contained in the cutset removed.
-categories: [functions]
-menu:
- docs:
- parent: functions
-keywords: [strings]
-signature: ["strings.TrimRight CUTSET STRING"]
-relatedfuncs: [strings.TrimRight]
----
-
-Given the string `"abba"`, trailing `"a"`'s can be removed a follows:
-
- {{ strings.TrimRight "a" "abba" }} → "abb"
-
-Numbers can be handled as well:
-
- {{ strings.TrimRight 12 1221341221 }} → "122134"
diff --git a/docs/content/en/functions/strings.TrimSuffix.md b/docs/content/en/functions/strings.TrimSuffix.md
deleted file mode 100644
index 05bb92400aa..00000000000
--- a/docs/content/en/functions/strings.TrimSuffix.md
+++ /dev/null
@@ -1,17 +0,0 @@
----
-title: strings.TrimSuffix
-description: Returns a given string s without the provided trailing suffix string. If s doesn't end with suffix, s is returned unchanged.
-categories: [functions]
-menu:
- docs:
- parent: functions
-keywords: [strings]
-signature: ["strings.TrimSuffix SUFFIX STRING"]
-relatedfuncs: [strings.TrimPrefix]
----
-
-Given the string `"aabbaa"`, the specified suffix is only removed if `"aabbaa"` ends with it:
-
- {{ strings.TrimSuffix "a" "aabbaa" }} → "aabba"
- {{ strings.TrimSuffix "aa" "aabbaa" }} → "aabb"
- {{ strings.TrimSuffix "aaa" "aabbaa" }} → "aabbaa"
diff --git a/docs/content/en/functions/strings/Chomp.md b/docs/content/en/functions/strings/Chomp.md
new file mode 100644
index 00000000000..22e2b546b5b
--- /dev/null
+++ b/docs/content/en/functions/strings/Chomp.md
@@ -0,0 +1,31 @@
+---
+title: chomp
+linkTitle: chomp
+description: Removes any trailing newline characters.
+categories: [functions]
+keywords: []
+menu:
+ docs:
+ parent: functions
+function:
+ aliases: [chomp]
+ returnType: any
+ signatures: [strings.Chomp STRING]
+relatedFunctions:
+ - strings.Chomp
+ - strings.Trim
+ - strings.TrimLeft
+ - strings.TrimPrefix
+ - strings.TrimRight
+ - strings.TrimSuffix
+aliases: [/functions/chomp]
+---
+
+If the argument is of type template.HTML, returns template.HTML, else returns a string.
+
+
+Useful in a pipeline to remove newlines added by other processing (e.g., [`markdownify`](/functions/transform/markdownify)).
+
+```go-html-template
+{{ chomp "
Blockhead
\n" }} → "
Blockhead
"
+```
diff --git a/docs/content/en/functions/strings/Contains.md b/docs/content/en/functions/strings/Contains.md
new file mode 100644
index 00000000000..66a90aeea31
--- /dev/null
+++ b/docs/content/en/functions/strings/Contains.md
@@ -0,0 +1,29 @@
+---
+title: strings.Contains
+description: Reports whether the string contains a substring.
+categories: [functions]
+keywords: []
+menu:
+ docs:
+ parent: functions
+function:
+ aliases: []
+ returnType: bool
+ signatures: [strings.Contains STRING SUBSTRING]
+relatedFunctions:
+ - strings.Contains
+ - strings.ContainsAny
+ - strings.ContainsNonSpace
+ - strings.HasPrefix
+ - strings.HasSuffix
+aliases: [/functions/strings.contains]
+---
+
+```go-html-template
+{{ strings.Contains "Hugo" "go" }} → true
+```
+The check is case sensitive:
+
+```go-html-template
+{{ strings.Contains "Hugo" "Go" }} → false
+```
diff --git a/docs/content/en/functions/strings/ContainsAny.md b/docs/content/en/functions/strings/ContainsAny.md
new file mode 100644
index 00000000000..4f324358adb
--- /dev/null
+++ b/docs/content/en/functions/strings/ContainsAny.md
@@ -0,0 +1,30 @@
+---
+title: strings.ContainsAny
+description: Reports whether a string contains any character from a given string.
+categories: [functions]
+keywords: []
+menu:
+ docs:
+ parent: functions
+function:
+ aliases: []
+ returnType: bool
+ signatures: [strings.ContainsAny STRING CHARACTERS]
+relatedFunctions:
+ - strings.Contains
+ - strings.ContainsAny
+ - strings.ContainsNonSpace
+ - strings.HasPrefix
+ - strings.HasSuffix
+aliases: [/functions/strings.containsany]
+---
+
+```go-html-template
+{{ strings.ContainsAny "Hugo" "gm" }} → true
+```
+
+The check is case sensitive:
+
+```go-html-template
+{{ strings.ContainsAny "Hugo" "Gm" }} → false
+```
diff --git a/docs/content/en/functions/strings.ContainsNonSpace.md b/docs/content/en/functions/strings/ContainsNonSpace.md
similarity index 68%
rename from docs/content/en/functions/strings.ContainsNonSpace.md
rename to docs/content/en/functions/strings/ContainsNonSpace.md
index eafe292f5bb..d2e6114b38c 100644
--- a/docs/content/en/functions/strings.ContainsNonSpace.md
+++ b/docs/content/en/functions/strings/ContainsNonSpace.md
@@ -2,12 +2,21 @@
title: strings.ContainsNonSpace
description: Reports whether a string contains any non-space characters as defined by Unicode’s White Space property.
categories: [functions]
+keywords: []
menu:
docs:
parent: functions
-keywords: [whitespace space]
-signature: ["strings.ContainsNonSpace STRING"]
-relatedfuncs: ["strings.Contains","strings.ContainsAny"]
+function:
+ aliases: []
+ returnType: bool
+ signatures: [strings.ContainsNonSpace STRING]
+relatedFunctions:
+ - strings.Contains
+ - strings.ContainsAny
+ - strings.ContainsNonSpace
+ - strings.HasPrefix
+ - strings.HasSuffix
+aliases: [/functions/strings.containsnonspace]
---
```go-html-template
diff --git a/docs/content/en/functions/strings/Count.md b/docs/content/en/functions/strings/Count.md
new file mode 100644
index 00000000000..25ea5896773
--- /dev/null
+++ b/docs/content/en/functions/strings/Count.md
@@ -0,0 +1,29 @@
+---
+title: strings.Count
+description: Returns the number of non-overlapping instances of a substring within a string.
+categories: [functions]
+keywords: []
+menu:
+ docs:
+ parent: functions
+function:
+ aliases: []
+ returnType: int
+ signatures: [strings.Count SUBSTR STRING]
+relatedFunctions:
+ - len
+ - strings.Count
+ - strings.CountRunes
+ - strings.CountWords
+ - strings.RuneCount
+aliases: [/functions/strings.count]
+---
+
+If `SUBSTR` is an empty string, this function returns 1 plus the number of Unicode code points in `STRING`.
+
+```go-html-template
+{{ "aaabaab" | strings.Count "a" }} → 5
+{{ "aaabaab" | strings.Count "aa" }} → 2
+{{ "aaabaab" | strings.Count "aaa" }} → 1
+{{ "aaabaab" | strings.Count "" }} → 8
+```
diff --git a/docs/content/en/functions/strings/CountRunes.md b/docs/content/en/functions/strings/CountRunes.md
new file mode 100644
index 00000000000..4a17d04ab9b
--- /dev/null
+++ b/docs/content/en/functions/strings/CountRunes.md
@@ -0,0 +1,29 @@
+---
+title: strings.CountRunes
+linkTitle: countrunes
+description: Returns the number of runes in a string excluding whitespace.
+categories: [functions]
+keywords: []
+menu:
+ docs:
+ parent: functions
+function:
+ aliases: [countrunes]
+ returnType: int
+ signatures: [strings.CountRunes INPUT]
+relatedFunctions:
+ - len
+ - strings.Count
+ - strings.CountRunes
+ - strings.CountWords
+ - strings.RuneCount
+aliases: [/functions/countrunes]
+---
+
+In contrast with the [`strings.RuneCount`] function, which counts every rune in a string, `strings.CountRunes` excludes whitespace.
+
+```go-html-template
+{{ "Hello, 世界" | strings.CountRunes }} → 8
+```
+
+[`strings.RuneCount`]: /functions/strings/runecount
diff --git a/docs/content/en/functions/countwords.md b/docs/content/en/functions/strings/CountWords.md
similarity index 54%
rename from docs/content/en/functions/countwords.md
rename to docs/content/en/functions/strings/CountWords.md
index 33dcbcaef50..e6915e6cd47 100644
--- a/docs/content/en/functions/countwords.md
+++ b/docs/content/en/functions/strings/CountWords.md
@@ -1,13 +1,23 @@
---
-title: countwords
+title: strings.CountWords
+linkTitle: countwords
description: Counts the number of words in a string.
categories: [functions]
+keywords: []
menu:
docs:
parent: functions
-keywords: [counting, word count]
-signature: ["countwords INPUT"]
-relatedfuncs: [countrunes]
+function:
+ aliases: [countwords]
+ returnType: int
+ signatures: [strings.CountWords INPUT]
+relatedFunctions:
+ - len
+ - strings.Count
+ - strings.CountRunes
+ - strings.CountWords
+ - strings.RuneCount
+aliases: [/functions/countwords]
---
The template function works similar to the [.WordCount page variable][pagevars].
diff --git a/docs/content/en/functions/findresubmatch.md b/docs/content/en/functions/strings/FindRESubmatch.md
similarity index 82%
rename from docs/content/en/functions/findresubmatch.md
rename to docs/content/en/functions/strings/FindRESubmatch.md
index f51ccdb97e2..5a0410fdb7d 100644
--- a/docs/content/en/functions/findresubmatch.md
+++ b/docs/content/en/functions/strings/FindRESubmatch.md
@@ -1,20 +1,27 @@
---
-title: findRESubmatch
+title: strings.FindRESubmatch
+linkTitle: findRESubmatch
description: Returns a slice of all successive matches of the regular expression. Each element is a slice of strings holding the text of the leftmost match of the regular expression and the matches, if any, of its subexpressions.
categories: [functions]
+keywords: []
menu:
docs:
parent: functions
-keywords: [regex]
-signature:
- - "findRESubmatch PATTERN INPUT [LIMIT]"
- - "strings.FindRESubmatch PATTERN INPUT [LIMIT]"
-relatedfuncs: [findRE, replaceRE]
+function:
+ aliases: [findRESubmatch]
+ returnType: '[]string'
+ signatures: ['strings.FindRESubmatch PATTERN INPUT [LIMIT]']
+relatedFunctions:
+ - strings.FindRE
+ - strings.FindRESubmatch
+ - strings.Replace
+ - strings.ReplaceRE
+aliases: [/functions/findresubmatch]
---
By default, `findRESubmatch` finds all matches. You can limit the number of matches with an optional LIMIT argument. A return value of nil indicates no match.
-{{% readfile file="/functions/common/regular-expressions.md" %}}
+{{% readfile file="/functions/_common/regular-expressions.md" %}}
## Demonstrative examples
diff --git a/docs/content/en/functions/findRe.md b/docs/content/en/functions/strings/FindRe.md
similarity index 69%
rename from docs/content/en/functions/findRe.md
rename to docs/content/en/functions/strings/FindRe.md
index 104db0f272a..4a7811f3d88 100644
--- a/docs/content/en/functions/findRe.md
+++ b/docs/content/en/functions/strings/FindRe.md
@@ -1,19 +1,26 @@
---
-title: findRE
+title: strings.FindRE
+linkTitle: findRE
description: Returns a slice of strings that match the regular expression.
categories: [functions]
+keywords: []
menu:
docs:
parent: functions
-keywords: [regex]
-signature:
- - "findRE PATTERN INPUT [LIMIT]"
- - "strings.FindRE PATTERN INPUT [LIMIT]"
-relatedfuncs: [findRESubmatch, replaceRE]
+function:
+ aliases: [findRE]
+ returnType: string
+ signatures: ['strings.FindRE PATTERN INPUT [LIMIT]']
+relatedFunctions:
+ - strings.FindRE
+ - strings.FindRESubmatch
+ - strings.Replace
+ - strings.ReplaceRE
+aliases: [/functions/findre]
---
By default, `findRE` finds all matches. You can limit the number of matches with an optional LIMIT argument.
-{{% readfile file="/functions/common/regular-expressions.md" %}}
+{{% readfile file="/functions/_common/regular-expressions.md" %}}
This example returns a slice of all second level headings (`h2` elements) within the rendered `.Content`:
diff --git a/docs/content/en/functions/strings/FirstUpper.md b/docs/content/en/functions/strings/FirstUpper.md
new file mode 100644
index 00000000000..320f01edaf6
--- /dev/null
+++ b/docs/content/en/functions/strings/FirstUpper.md
@@ -0,0 +1,23 @@
+---
+title: strings.FirstUpper
+description: Capitalizes the first character of a given string.
+categories: [functions]
+keywords: []
+menu:
+ docs:
+ parent: functions
+function:
+ aliases: []
+ returnType: string
+ signatures: [strings.FirstUpper STRING]
+relatedFunctions:
+ - strings.FirstUpper
+ - strings.Title
+ - strings.ToLower
+ - strings.ToUpper
+aliases: [/functions/strings.firstupper]
+---
+
+```go-html-template
+{{ strings.FirstUpper "foo" }} → "Foo"
+```
diff --git a/docs/content/en/functions/strings/HasPrefix.md b/docs/content/en/functions/strings/HasPrefix.md
new file mode 100644
index 00000000000..88a79a935b5
--- /dev/null
+++ b/docs/content/en/functions/strings/HasPrefix.md
@@ -0,0 +1,24 @@
+---
+title: strings.HasPrefix
+description: Reports whether a string begins with prefix.
+categories: [functions]
+keywords: []
+menu:
+ docs:
+ parent: functions
+function:
+ aliases: [hasPrefix]
+ returnType: bool
+ signatures: [strings.HasPrefix STRING PREFIX]
+relatedFunctions:
+ - strings.Contains
+ - strings.ContainsAny
+ - strings.ContainsNonSpace
+ - strings.HasPrefix
+ - strings.HasSuffix
+aliases: [/functions/hasprefix,/functions/strings.hasprefix]
+---
+
+```go-html-template
+{{ hasPrefix "Hugo" "Hu" }} → true
+```
diff --git a/docs/content/en/functions/strings/HasSuffix.md b/docs/content/en/functions/strings/HasSuffix.md
new file mode 100644
index 00000000000..d11f3e8cf95
--- /dev/null
+++ b/docs/content/en/functions/strings/HasSuffix.md
@@ -0,0 +1,24 @@
+---
+title: strings.HasSuffix
+description: Reports whether a string ends with suffix.
+categories: [functions]
+keywords: []
+menu:
+ docs:
+ parent: functions
+function:
+ aliases: [hasSuffix]
+ returnType: bool
+ signatures: [strings.HasSuffix STRING SUFFIX]
+relatedFunctions:
+ - strings.Contains
+ - strings.ContainsAny
+ - strings.ContainsNonSpace
+ - strings.HasPrefix
+ - strings.HasSuffix
+aliases: [/functions/hassuffix,/functions/strings/hassuffix]
+---
+
+```go-html-template
+{{ hasSuffix "Hugo" "go" }} → true
+```
diff --git a/docs/content/en/functions/strings/Repeat.md b/docs/content/en/functions/strings/Repeat.md
new file mode 100644
index 00000000000..718f2498496
--- /dev/null
+++ b/docs/content/en/functions/strings/Repeat.md
@@ -0,0 +1,20 @@
+---
+title: strings.Repeat
+description: Returns a new string consisting of zero or more copies of another string.
+categories: [functions]
+keywords: []
+menu:
+ docs:
+ parent: functions
+function:
+ aliases: []
+ returnType: string
+ signatures: [strings.Repeat COUNT INPUT]
+relatedFunctions: []
+aliases: [/functions/strings.repeat]
+---
+
+```go-html-template
+{{ strings.Repeat 3 "yo" }} → "yoyoyo"
+{{ "yo" | strings.Repeat 3 }} → "yoyoyo"
+```
diff --git a/docs/content/en/functions/replace.md b/docs/content/en/functions/strings/Replace.md
similarity index 53%
rename from docs/content/en/functions/replace.md
rename to docs/content/en/functions/strings/Replace.md
index 4c150bfefed..8d5e548594a 100644
--- a/docs/content/en/functions/replace.md
+++ b/docs/content/en/functions/strings/Replace.md
@@ -1,22 +1,29 @@
---
-title: replace
+title: strings.Replace
+linkTitle: replace
description: Replaces all occurrences of the search string with the replacement string.
categories: [functions]
+keywords: []
menu:
docs:
parent: functions
-keywords: [replace]
-signature:
- - "replace INPUT OLD NEW [LIMIT]"
- - "strings.Replace INPUT OLD NEW [LIMIT]"
-relatedfuncs: [replaceRE]
+function:
+ aliases: [replace]
+ returnType: string
+ signatures: ['strings.Replace INPUT OLD NEW [LIMIT]']
+relatedFunctions:
+ - strings.FindRE
+ - strings.FindRESubmatch
+ - strings.Replace
+ - strings.ReplaceRE
+aliases: [/functions/replace]
---
Replace returns a copy of `INPUT` with all occurrences of `OLD` replaced with `NEW`.
The number of replacements can be limited with an optional `LIMIT` argument.
```
-`{{ replace "Batman and Robin" "Robin" "Catwoman" }}`
+{{ replace "Batman and Robin" "Robin" "Catwoman" }}
→ "Batman and Catwoman"
{{ replace "aabbaabb" "a" "z" 2 }} → "zzbbaabb"
diff --git a/docs/content/en/functions/replacere.md b/docs/content/en/functions/strings/ReplaceRE.md
similarity index 74%
rename from docs/content/en/functions/replacere.md
rename to docs/content/en/functions/strings/ReplaceRE.md
index 4dba19bfe64..247595877a6 100644
--- a/docs/content/en/functions/replacere.md
+++ b/docs/content/en/functions/strings/ReplaceRE.md
@@ -1,19 +1,26 @@
---
-title: replaceRE
+title: strings.ReplaceRE
+linkTitle: replaceRE
description: Returns a string, replacing all occurrences of a regular expression with a replacement pattern.
categories: [functions]
+keywords: []
menu:
docs:
parent: functions
-keywords: [regex]
-signature:
- - "replaceRE PATTERN REPLACEMENT INPUT [LIMIT]"
- - "strings.ReplaceRE PATTERN REPLACEMENT INPUT [LIMIT]"
-relatedfuncs: [findRE, FindRESubmatch, replace]
+function:
+ aliases: [replaceRE]
+ returnType: string
+ signatures: ['strings.ReplaceRE PATTERN REPLACEMENT INPUT [LIMIT]']
+relatedFunctions:
+ - strings.FindRE
+ - strings.FindRESubmatch
+ - strings.Replace
+ - strings.ReplaceRE
+aliases: [/functions/replacere]
---
By default, `replaceRE` replaces all matches. You can limit the number of matches with an optional LIMIT argument.
-{{% readfile file="/functions/common/regular-expressions.md" %}}
+{{% readfile file="/functions/_common/regular-expressions.md" %}}
This example replaces two or more consecutive hyphens with a single hyphen:
diff --git a/docs/content/en/functions/strings/RuneCount.md b/docs/content/en/functions/strings/RuneCount.md
new file mode 100644
index 00000000000..a4d5a8dbec4
--- /dev/null
+++ b/docs/content/en/functions/strings/RuneCount.md
@@ -0,0 +1,28 @@
+---
+title: strings.RuneCount
+description: Returns the number of runes in a string.
+categories: [functions]
+keywords: []
+menu:
+ docs:
+ parent: functions
+function:
+ aliases: []
+ returnType: int
+ signatures: [strings.RuneCount INPUT]
+relatedFunctions:
+ - len
+ - strings.Count
+ - strings.CountRunes
+ - strings.CountWords
+ - strings.RuneCount
+aliases: [/functions/strings.runecount]
+---
+
+In contrast with the [`strings.CountRunes`] function, which excludes whitespace, `strings.RuneCount` counts every rune in a string.
+
+```go-html-template
+{{ "Hello, 世界" | strings.RuneCount }} → 9
+```
+
+[`strings.CountRunes`]: /functions/strings/countrunes
diff --git a/docs/content/en/functions/strings/SliceString.md b/docs/content/en/functions/strings/SliceString.md
new file mode 100644
index 00000000000..8d26d76e473
--- /dev/null
+++ b/docs/content/en/functions/strings/SliceString.md
@@ -0,0 +1,24 @@
+---
+title: strings.SliceString
+linkTitle: slicestr
+description: Creates a slice of a half-open range, including start and end indices.
+categories: [functions]
+keywords: []
+menu:
+ docs:
+ parent: functions
+function:
+ aliases: [slicestr]
+ returnType: string
+ signatures: ['strings.SliceString STRING START [END]']
+relatedFunctions: []
+aliases: [/functions/slicestr]
+---
+
+For example, 1 and 4 creates a slice including elements 1 through 3.
+The `end` index can be omitted; it defaults to the string's length.
+
+```go-html-template
+{{ slicestr "BatMan" 3 }}` → "Man"
+{{ slicestr "BatMan" 0 3 }}` → "Bat"
+```
diff --git a/docs/content/en/functions/strings/Split.md b/docs/content/en/functions/strings/Split.md
new file mode 100644
index 00000000000..7d15704b2b0
--- /dev/null
+++ b/docs/content/en/functions/strings/Split.md
@@ -0,0 +1,30 @@
+---
+title: strings.Split
+linkTitle: split
+description: Returns a slice of strings by splitting STRING by DELIM.
+categories: [functions]
+keywords: []
+menu:
+ docs:
+ parent: functions
+function:
+ aliases: [split]
+ returnType: string
+ signatures: [strings.Split STRING DELIM]
+relatedFunctions:
+ - collections.Delimit
+ - strings.Split
+aliases: [/functions/split]
+---
+
+Examples:
+
+```go-html-template
+{{ split "tag1,tag2,tag3" "," }} → ["tag1", "tag2", "tag3"]
+{{ split "abc" "" }} → ["a", "b", "c"]
+```
+
+
+{{% note %}}
+`split` essentially does the opposite of [delimit](/functions/collections/delimit). While `split` creates a slice from a string, `delimit` creates a string from a slice.
+{{% /note %}}
diff --git a/docs/content/en/functions/substr.md b/docs/content/en/functions/strings/Substr.md
similarity index 83%
rename from docs/content/en/functions/substr.md
rename to docs/content/en/functions/strings/Substr.md
index 90ee47b550a..9dafa0737e9 100644
--- a/docs/content/en/functions/substr.md
+++ b/docs/content/en/functions/strings/Substr.md
@@ -1,15 +1,18 @@
---
-title: substr
+title: strings.Substr
+linkTitle: substr
description: Extracts parts of a string from a specified character's position and returns the specified number of characters.
categories: [functions]
+keywords: []
menu:
docs:
parent: functions
-keywords: [strings]
-signature:
- - "substr STRING START [LENGTH]"
- - "strings.Substr STRING START [LENGTH]"
-relatedfuncs: []
+function:
+ aliases: [substr]
+ returnType: string
+ signatures: ['strings.Substr STRING START [LENGTH]']
+relatedFunctions: []
+aliases: [/functions/substr]
---
It normally takes two argument: `start` and `length`. It can also take one argument: `start`, i.e. `length` is omitted, in which case the substring starting from start until the end of the string will be returned.
diff --git a/docs/content/en/functions/title.md b/docs/content/en/functions/strings/Title.md
similarity index 71%
rename from docs/content/en/functions/title.md
rename to docs/content/en/functions/strings/Title.md
index d8e0f73a494..1e20d1f596f 100644
--- a/docs/content/en/functions/title.md
+++ b/docs/content/en/functions/strings/Title.md
@@ -1,15 +1,22 @@
---
-title: title
+title: strings.Title
+linkTitle: title
description: Converts the provided string to title case.
categories: [functions]
+keywords: []
menu:
docs:
parent: functions
-keywords: [strings]
-signature:
- - "title STRING"
- - "strings.Title STRING"
-relatedfuncs: []
+function:
+ aliases: [title]
+ returnType: string
+ signatures: [strings.Title STRING]
+relatedFunctions:
+ - strings.FirstUpper
+ - strings.Title
+ - strings.ToLower
+ - strings.ToUpper
+aliases: [/functions/title]
---
```go-html-template
diff --git a/docs/content/en/functions/lower.md b/docs/content/en/functions/strings/ToLower.md
similarity index 53%
rename from docs/content/en/functions/lower.md
rename to docs/content/en/functions/strings/ToLower.md
index 9accf999e23..cb76462ea65 100644
--- a/docs/content/en/functions/lower.md
+++ b/docs/content/en/functions/strings/ToLower.md
@@ -1,15 +1,22 @@
---
-title: lower
+title: strings.ToLower
+linkTitle: lower
description: Converts all characters in the provided string to lowercase.
categories: [functions]
+keywords: []
menu:
docs:
parent: functions
-keywords: [strings,casing]
-signature:
- - "lower INPUT"
- - "strings.ToLower INPUT"
-relatedfuncs: []
+function:
+ aliases: [lower]
+ returnType: string
+ signatures: [strings.ToLower INPUT]
+relatedFunctions:
+ - strings.FirstUpper
+ - strings.Title
+ - strings.ToLower
+ - strings.ToUpper
+aliases: [/functions/lower]
---
diff --git a/docs/content/en/functions/upper.md b/docs/content/en/functions/strings/ToUpper.md
similarity index 55%
rename from docs/content/en/functions/upper.md
rename to docs/content/en/functions/strings/ToUpper.md
index e11065f79c1..d464916372d 100644
--- a/docs/content/en/functions/upper.md
+++ b/docs/content/en/functions/strings/ToUpper.md
@@ -1,16 +1,22 @@
---
-title: upper
+title: strings.ToUpper
+linkTitle: upper
description: Converts all characters in a string to uppercase
-keywords: []
categories: [functions]
+keywords: []
menu:
docs:
parent: functions
-toc:
-signature:
- - "upper INPUT"
- - "strings.ToUpper INPUT"
-relatedfuncs: []
+function:
+ aliases: [upper]
+ returnType: string
+ signatures: [strings.ToUpper INPUT]
+relatedFunctions:
+ - strings.FirstUpper
+ - strings.Title
+ - strings.ToLower
+ - strings.ToUpper
+aliases: [/functions/upper]
---
Note that `upper` can be applied in your templates in more than one way:
diff --git a/docs/content/en/functions/trim.md b/docs/content/en/functions/strings/Trim.md
similarity index 75%
rename from docs/content/en/functions/trim.md
rename to docs/content/en/functions/strings/Trim.md
index 3d664abea91..9eae9ee4580 100644
--- a/docs/content/en/functions/trim.md
+++ b/docs/content/en/functions/strings/Trim.md
@@ -1,15 +1,24 @@
---
-title: trim
+title: strings.Trim
+linkTitle: trim
description: Returns a slice of a passed string with all leading and trailing characters from cutset removed.
categories: [functions]
+keywords: []
menu:
docs:
parent: functions
-keywords: [strings]
-signature:
- - "trim INPUT CUTSET"
- - "strings.Trim INPUT CUTSET"
-relatedfuncs: []
+function:
+ aliases: [title]
+ returnType: string
+ signatures: [strings.Trim INPUT CUTSET]
+relatedFunctions:
+ - strings.Chomp
+ - strings.Trim
+ - strings.TrimLeft
+ - strings.TrimPrefix
+ - strings.TrimRight
+ - strings.TrimSuffix
+aliases: [/functions/trim]
---
```go-html-template
diff --git a/docs/content/en/functions/strings/TrimLeft.md b/docs/content/en/functions/strings/TrimLeft.md
new file mode 100644
index 00000000000..3924e492fe0
--- /dev/null
+++ b/docs/content/en/functions/strings/TrimLeft.md
@@ -0,0 +1,33 @@
+---
+title: strings.TrimLeft
+description: Returns a slice of a given string with all leading characters contained in the cutset removed.
+categories: [functions]
+keywords: []
+menu:
+ docs:
+ parent: functions
+function:
+ aliases: []
+ returnType: string
+ signatures: [strings.TrimLeft CUTSET STRING]
+relatedFunctions:
+ - strings.Chomp
+ - strings.Trim
+ - strings.TrimLeft
+ - strings.TrimPrefix
+ - strings.TrimRight
+ - strings.TrimSuffix
+aliases: [/functions/strings.trimleft]
+---
+
+Given the string `"abba"`, leading `"a"`'s can be removed a follows:
+
+```go-html-template
+{{ strings.TrimLeft "a" "abba" }} → "bba"
+```
+
+Numbers can be handled as well:
+
+```go-html-template
+{{ strings.TrimLeft 12 1221341221 }} → "341221"
+```
diff --git a/docs/content/en/functions/strings/TrimPrefix.md b/docs/content/en/functions/strings/TrimPrefix.md
new file mode 100644
index 00000000000..37657732d67
--- /dev/null
+++ b/docs/content/en/functions/strings/TrimPrefix.md
@@ -0,0 +1,29 @@
+---
+title: strings.TrimPrefix
+description: Returns a given string s without the provided leading prefix string. If s doesn't start with prefix, s is returned unchanged.
+categories: [functions]
+keywords: []
+menu:
+ docs:
+ parent: functions
+function:
+ aliases: []
+ returnType: string
+ signatures: [strings.TrimPrefix PREFIX STRING]
+relatedFunctions:
+ - strings.Chomp
+ - strings.Trim
+ - strings.TrimLeft
+ - strings.TrimPrefix
+ - strings.TrimRight
+ - strings.TrimSuffix
+aliases: [/functions/strings.trimprefix]
+---
+
+Given the string `"aabbaa"`, the specified prefix is only removed if `"aabbaa"` starts with it:
+
+```go-html-template
+{{ strings.TrimPrefix "a" "aabbaa" }} → "abbaa"
+{{ strings.TrimPrefix "aa" "aabbaa" }} → "bbaa"
+{{ strings.TrimPrefix "aaa" "aabbaa" }} → "aabbaa"
+```
diff --git a/docs/content/en/functions/strings/TrimRight.md b/docs/content/en/functions/strings/TrimRight.md
new file mode 100644
index 00000000000..fa538b605fa
--- /dev/null
+++ b/docs/content/en/functions/strings/TrimRight.md
@@ -0,0 +1,33 @@
+---
+title: strings.TrimRight
+description: Returns a slice of a given string with all trailing characters contained in the cutset removed.
+categories: [functions]
+keywords: []
+menu:
+ docs:
+ parent: functions
+function:
+ aliases: []
+ returnType: string
+ signatures: [strings.TrimRight CUTSET STRING]
+relatedFunctions:
+ - strings.Chomp
+ - strings.Trim
+ - strings.TrimLeft
+ - strings.TrimPrefix
+ - strings.TrimRight
+ - strings.TrimSuffix
+aliases: [/functions/strings.trimright]
+---
+
+Given the string `"abba"`, trailing `"a"`'s can be removed a follows:
+
+```go-html-template
+{{ strings.TrimRight "a" "abba" }} → "abb"
+```
+
+Numbers can be handled as well:
+
+```go-html-template
+{{ strings.TrimRight 12 1221341221 }} → "122134"
+```
diff --git a/docs/content/en/functions/strings/TrimSuffix.md b/docs/content/en/functions/strings/TrimSuffix.md
new file mode 100644
index 00000000000..6dc9becfc15
--- /dev/null
+++ b/docs/content/en/functions/strings/TrimSuffix.md
@@ -0,0 +1,29 @@
+---
+title: strings.TrimSuffix
+description: Returns a given string s without the provided trailing suffix string. If s doesn't end with suffix, s is returned unchanged.
+categories: [functions]
+keywords: []
+menu:
+ docs:
+ parent: functions
+function:
+ aliases: []
+ returnType: string
+ signatures: [strings.TrimSuffix SUFFIX STRING]
+relatedFunctions:
+ - strings.Chomp
+ - strings.Trim
+ - strings.TrimLeft
+ - strings.TrimPrefix
+ - strings.TrimRight
+ - strings.TrimSuffix
+aliases: [/functions/strings.trimsuffix]
+---
+
+Given the string `"aabbaa"`, the specified suffix is only removed if `"aabbaa"` ends with it:
+
+```go-html-template
+{{ strings.TrimSuffix "a" "aabbaa" }} → "aabba"
+{{ strings.TrimSuffix "aa" "aabbaa" }} → "aabb"
+{{ strings.TrimSuffix "aaa" "aabbaa" }} → "aabbaa"
+```
diff --git a/docs/content/en/functions/strings/Truncate.md b/docs/content/en/functions/strings/Truncate.md
new file mode 100644
index 00000000000..0bd78d8407c
--- /dev/null
+++ b/docs/content/en/functions/strings/Truncate.md
@@ -0,0 +1,26 @@
+---
+title: strings.Truncate
+linkTitle: truncate
+description: Truncates a text to a max length without cutting words or leaving unclosed HTML tags.
+categories: [functions]
+keywords: []
+menu:
+ docs:
+ parent: functions
+function:
+ aliases: [truncate]
+ returnType: template.HTML
+ signatures: ['strings.Truncate SIZE [ELLIPSIS] INPUT']
+relatedFunctions: []
+aliases: [/functions/truncate]
+---
+
+Since Go templates are HTML-aware, `truncate` will intelligently handle normal strings vs HTML strings:
+
+```go-html-template
+{{ "Keep my HTML" | safeHTML | truncate 10 }} → Keep my …
+```
+
+{{% note %}}
+If you have a raw string that contains HTML tags you want to remain treated as HTML, you will need to convert the string to HTML using the [`safeHTML` template function](/functions/safe/html) before sending the value to truncate. Otherwise, the HTML tags will be escaped when passed through the `truncate` function.
+{{% /note %}}
diff --git a/docs/content/en/functions/symdiff.md b/docs/content/en/functions/symdiff.md
deleted file mode 100644
index ffc3094186e..00000000000
--- a/docs/content/en/functions/symdiff.md
+++ /dev/null
@@ -1,20 +0,0 @@
----
-title: symdiff
-description: "`collections.SymDiff` (alias `symdiff`) returns the symmetric difference of two collections."
-categories: [functions]
-menu:
- docs:
- parent: functions
-keywords: [collections,intersect,union,complement]
-signature: ["COLLECTION | symdiff COLLECTION" ]
----
-
-Example:
-
-```go-html-template
-{{ slice 1 2 3 | symdiff (slice 3 4) }}
-```
-
-The above will print `[1 2 4]`.
-
-Also see https://en.wikipedia.org/wiki/Symmetric_difference
diff --git a/docs/content/en/functions/templates.Exists.md b/docs/content/en/functions/templates/Exists.md
similarity index 69%
rename from docs/content/en/functions/templates.Exists.md
rename to docs/content/en/functions/templates/Exists.md
index b9f340c21c4..d4a8fab7600 100644
--- a/docs/content/en/functions/templates.Exists.md
+++ b/docs/content/en/functions/templates/Exists.md
@@ -1,15 +1,18 @@
---
title: templates.Exists
-description: "Checks whether a template file exists under the given path relative to the `layouts` directory."
+description: Reports whether a template file exists under the given path relative to the `layouts` directory.
categories: [functions]
-tags: []
+keywords: []
menu:
docs:
parent: functions
-ns: ""
-keywords: ["templates", "template", "layouts"]
-signature: ["templates.Exists PATH"]
-relatedfuncs: []
+function:
+ aliases: []
+ returnType: bool
+ signatures: [templates.Exists PATH]
+namespace: templates
+relatedFunctions: []
+aliases: [/functions/templates.exists]
---
A template file is any file living below the `layouts` directories of either the project or any of its theme components including partials and shortcodes.
diff --git a/docs/content/en/functions/time.md b/docs/content/en/functions/time/AsTime.md
similarity index 85%
rename from docs/content/en/functions/time.md
rename to docs/content/en/functions/time/AsTime.md
index 99182f3175b..1244eeb5c1a 100644
--- a/docs/content/en/functions/time.md
+++ b/docs/content/en/functions/time/AsTime.md
@@ -1,13 +1,23 @@
---
-title: time
+title: time.AsTime
+linkTitle: time
description: Converts a timestamp string into a `time.Time` structure.
categories: [functions]
+keywords: []
menu:
docs:
parent: functions
-keywords: [dates,time,location]
-signature: ["time INPUT [TIMEZONE]"]
-relatedfuncs: []
+function:
+ aliases: [time]
+ returnType: time.Time
+ signatures: ['time.AsTime INPUT [TIMEZONE]']
+relatedFunctions:
+ - time.AsTime
+ - time.Duration
+ - time.Format
+ - time.Now
+ - time.ParseDuration
+aliases: [/functions/time]
---
@@ -49,6 +59,6 @@ The following example may be useful when setting up [multilingual sites][multili
{{< /code >}}
-[int]: /functions/int/
+[int]: /functions/cast/toint
[multilingual]: /content-management/multilingual/
-[`printf`]: /functions/printf/
+[`printf`]: /functions/fmt/printf
diff --git a/docs/content/en/functions/duration.md b/docs/content/en/functions/time/Duration.md
similarity index 58%
rename from docs/content/en/functions/duration.md
rename to docs/content/en/functions/time/Duration.md
index 4dc365ae5bd..921f25a968f 100644
--- a/docs/content/en/functions/duration.md
+++ b/docs/content/en/functions/time/Duration.md
@@ -1,23 +1,38 @@
---
-title: duration
+title: time.Duration
+linkTitle: duration
description: Returns a `time.Duration` structure, using the given time unit and duration number.
categories: [functions]
+keywords: []
menu:
docs:
parent: functions
-keywords: [time duration]
-signature: ["duration TIME_UNIT DURATION_NUMBER"]
+function:
+ aliases: [duration]
+ returnType: time.Duration
+ signatures: [time.Duration TIME_UNIT DURATION_NUMBER]
+relatedFunctions:
+ - time.AsTime
+ - time.Duration
+ - time.Format
+ - time.Now
+ - time.ParseDuration
+aliases: [/functions/duration]
---
`time.Duration` converts a given number into a [`time.Duration`](https://pkg.go.dev/time#Duration) structure so you can access its fields. E.g. you can perform [time operations](https://pkg.go.dev/time#Duration) on the returned `time.Duration` value:
- {{ printf "There are %.0f seconds in one day." (duration "hour" 24).Seconds }}
-
+```go-html-template
+{{ printf "There are %.0f seconds in one day." (duration "hour" 24).Seconds }}
+
+```
Make your code simpler to understand by using a [chained pipeline](https://pkg.go.dev/text/template#hdr-Pipelines):
- {{ mul 7.75 60 | duration "minute" }} → 7h45m0s
- {{ mul 120 60 | mul 1000 | duration "millisecond" }} → 2h0m0s
+```go-html-template
+{{ mul 7.75 60 | duration "minute" }} → 7h45m0s
+{{ mul 120 60 | mul 1000 | duration "millisecond" }} → 2h0m0s
+```
You have to specify a time unit for the number given to the function. Valid time units are:
diff --git a/docs/content/en/functions/time/Format.md b/docs/content/en/functions/time/Format.md
new file mode 100644
index 00000000000..3a0b1eb2ac7
--- /dev/null
+++ b/docs/content/en/functions/time/Format.md
@@ -0,0 +1,76 @@
+---
+title: time.Format
+description: Returns a formatted and localized time.Time value.
+categories: [functions]
+keywords: []
+menu:
+ docs:
+ parent: functions
+function:
+ aliases: [dateFormat]
+ returnType: string
+ signatures: [time.Format LAYOUT INPUT]
+relatedFunctions:
+ - time.AsTime
+ - time.Duration
+ - time.Format
+ - time.Now
+ - time.ParseDuration
+aliases: [/functions/dateformat]
+toc: true
+---
+
+```go-template
+{{ $t := "2023-01-27T23:44:58-08:00" }}
+{{ $format := "2 Jan 2006" }}
+
+{{ $t | time.Format $format }} → 27 Jan 2023
+
+{{ $t = time.AsTime $t }}
+{{ $t | time.Format $format }} → 27 Jan 2023
+```
+
+## Layout string
+
+{{% readfile file="/functions/_common/time-layout-string.md" %}}
+
+## Localization
+
+Use the `time.Format` function to localize `time.Time` values for the current language and region.
+
+{{% note %}}
+{{% readfile file="/functions/_common/locales.md" %}}
+{{% /note %}}
+
+
+Use the layout string as described above, or one of the tokens below. For example:
+
+```go-template
+{{ .Date | time.Format ":date_medium" }} → Jan 27, 2023
+```
+
+Localized to en-US:
+
+Token|Result
+:--|:--
+`:date_full`|`Friday, January 27, 2023`
+`:date_long`|`January 27, 2023`
+`:date_medium`|`Jan 27, 2023`
+`:date_short`|`1/27/23`
+`:time_full`|`11:44:58 pm Pacific Standard Time`
+`:time_long`|`11:44:58 pm PST`
+`:time_medium`|`11:44:58 pm`
+`:time_short`|`11:44 pm`
+
+Localized to de-DE:
+
+Token|Result
+:--|:--
+`:date_full`|`Freitag, 27. Januar 2023`
+`:date_long`|`27. Januar 2023`
+`:date_medium`|`27.01.2023`
+`:date_short`|`27.01.23`
+`:time_full`|`23:44:58 Nordamerikanische Westküsten-Normalzeit`
+`:time_long`|`23:44:58 PST`
+`:time_medium`|`23:44:58`
+`:time_short`|`23:44`
diff --git a/docs/content/en/functions/now.md b/docs/content/en/functions/time/Now.md
similarity index 79%
rename from docs/content/en/functions/now.md
rename to docs/content/en/functions/time/Now.md
index 68d628f119c..74b01ecc5b1 100644
--- a/docs/content/en/functions/now.md
+++ b/docs/content/en/functions/time/Now.md
@@ -1,13 +1,23 @@
---
-title: now
+title: time.Now
+linkTitle: now
description: Returns the current local time
categories: [functions]
+keywords: []
menu:
docs:
parent: functions
-keywords: [dates,time]
-signature: ["now"]
-relatedfuncs: [Unix,dateFormat]
+function:
+ aliases: [now]
+ returnType: time.Time
+ signatures: [time.Now]
+relatedFunctions:
+ - time.AsTime
+ - time.Duration
+ - time.Format
+ - time.Now
+ - time.ParseDuration
+aliases: [/functions/now]
---
See [`time.Time`](https://godoc.org/time#Time).
diff --git a/docs/content/en/functions/time.ParseDuration.md b/docs/content/en/functions/time/ParseDuration.md
similarity index 60%
rename from docs/content/en/functions/time.ParseDuration.md
rename to docs/content/en/functions/time/ParseDuration.md
index 0332c170634..e3abc7c1521 100644
--- a/docs/content/en/functions/time.ParseDuration.md
+++ b/docs/content/en/functions/time/ParseDuration.md
@@ -2,11 +2,21 @@
title: time.ParseDuration
description: Parses a given duration string into a `time.Duration` structure.
categories: [functions]
+keywords: []
menu:
docs:
parent: functions
-keywords: [time parse duration]
-signature: ["time.ParseDuration DURATION"]
+function:
+ aliases: []
+ returnType: time.Duration
+ signatures: [time.ParseDuration DURATION]
+relatedFunctions:
+ - time.AsTime
+ - time.Duration
+ - time.Format
+ - time.Now
+ - time.ParseDuration
+aliases: [/functions/time.parseduration]
---
`time.ParseDuration` parses a duration string into a [`time.Duration`](https://pkg.go.dev/time#Duration) structure so you can access its fields.
@@ -14,5 +24,7 @@ A duration string is a possibly signed sequence of decimal numbers, each with op
You can perform [time operations](https://pkg.go.dev/time#Duration) on the returned `time.Duration` value:
- {{ printf "There are %.0f seconds in one day." (time.ParseDuration "24h").Seconds }}
-
+```go-html-template
+{{ printf "There are %.0f seconds in one day." (time.ParseDuration "24h").Seconds }}
+
+```
diff --git a/docs/content/en/functions/transform/CanHighlight.md b/docs/content/en/functions/transform/CanHighlight.md
new file mode 100644
index 00000000000..eabef933b89
--- /dev/null
+++ b/docs/content/en/functions/transform/CanHighlight.md
@@ -0,0 +1,22 @@
+---
+title: transform.CanHighlight
+description: Reports whether the given code language is supported by the Chroma highlighter.
+categories: [functions]
+keywords: []
+menu:
+ docs:
+ parent: functions
+function:
+ aliases: []
+ returnType: bool
+ signatures: [transform.CanHighlight LANGUAGE]
+relatedFunctions:
+ - transform.CanHighlight
+ - transform.Highlight
+ - transform.HighlightCodeBlock
+---
+
+```go-html-template
+{{ transform.CanHighlight "go" }} → true
+{{ transform.CanHighlight "klingon" }} → false
+```
diff --git a/docs/content/en/functions/emojify.md b/docs/content/en/functions/transform/Emojify.md
similarity index 78%
rename from docs/content/en/functions/emojify.md
rename to docs/content/en/functions/transform/Emojify.md
index beded710a8d..324c4185125 100644
--- a/docs/content/en/functions/emojify.md
+++ b/docs/content/en/functions/transform/Emojify.md
@@ -1,13 +1,19 @@
---
-title: emojify
+title: transform.Emojify
+linkTitle: emojify
description: Runs a string through the Emoji emoticons processor.
categories: [functions]
+keywords: []
menu:
docs:
parent: functions
-keywords: [strings,emojis]
-signature: ["emojify INPUT"]
-relatedfuncs: []
+function:
+ aliases: [emojify]
+ returnType: template.HTML
+ signatures: [transform.Emojify INPUT]
+namespace: transform
+relatedFunctions: []
+aliases: [/functions/emojify]
---
`emojify` runs a passed string through the Emoji emoticons processor.
diff --git a/docs/content/en/functions/htmlEscape.md b/docs/content/en/functions/transform/HTMLEscape.md
similarity index 57%
rename from docs/content/en/functions/htmlEscape.md
rename to docs/content/en/functions/transform/HTMLEscape.md
index 0ee8fa4d224..62249367bb9 100644
--- a/docs/content/en/functions/htmlEscape.md
+++ b/docs/content/en/functions/transform/HTMLEscape.md
@@ -1,13 +1,20 @@
---
-title: htmlEscape
+title: transform.HTMLEscape
+linkTitle: htmlEscape
description: Returns the given string with the reserved HTML codes escaped.
categories: [functions]
+keywords: []
menu:
docs:
parent: functions
-keywords: [strings, html]
-signature: ["htmlEscape INPUT"]
-relatedfuncs: [htmlUnescape]
+function:
+ aliases: [htmlEscape]
+ returnType: string
+ signatures: [transform.HTMLEscape INPUT]
+relatedFunctions:
+ - transform.HTMLEscape
+ - transform.HTMLUnescape
+aliases: [/functions/htmlescape]
---
In the result `&` becomes `&` and so on. It escapes only: `<`, `>`, `&`, `'` and `"`.
diff --git a/docs/content/en/functions/htmlUnescape.md b/docs/content/en/functions/transform/HTMLUnescape.md
similarity index 62%
rename from docs/content/en/functions/htmlUnescape.md
rename to docs/content/en/functions/transform/HTMLUnescape.md
index e4646b68070..c0774232fcb 100644
--- a/docs/content/en/functions/htmlUnescape.md
+++ b/docs/content/en/functions/transform/HTMLUnescape.md
@@ -1,17 +1,22 @@
---
-title: htmlUnescape
+title: transform.HTMLUnescape
+linkTitle: htmlUnescape
description: Returns the given string with HTML escape codes un-escaped.
categories: [functions]
+keywords: []
menu:
docs:
parent: functions
-keywords: []
-signature: ["htmlUnescape INPUT"]
-relatedfuncs: [htmlEscape]
+function:
+ aliases: [htmlUnescape]
+ returnType: string
+ signatures: [transform.HTMLUnescape INPUT]
+relatedFunctions:
+ - transform.HTMLEscape
+ - transform.HTMLUnescape
+aliases: [/functions/htmlunescape]
---
-`htmlUnescape` returns the given string with HTML escape codes un-escaped.
-
Remember to pass the output of this to `safeHTML` if fully un-escaped characters are desired. Otherwise, the output will be escaped again as normal.
```go-html-template
diff --git a/docs/content/en/functions/highlight.md b/docs/content/en/functions/transform/Highlight.md
similarity index 91%
rename from docs/content/en/functions/highlight.md
rename to docs/content/en/functions/transform/Highlight.md
index f91c1f56234..93043b4a1df 100644
--- a/docs/content/en/functions/highlight.md
+++ b/docs/content/en/functions/transform/Highlight.md
@@ -1,15 +1,25 @@
---
-title: highlight
+title: transform.Highlight
+linkTitle: highlight
description: Renders code with a syntax highlighter.
categories: [functions]
+keywords: []
menu:
docs:
parent: functions
-keywords: [highlighting,code blocks,syntax]
-signature: ["transform.Highlight INPUT LANG [OPTIONS]","highlight INPUT LANG [OPTIONS]"]
-relatedfuncs: []
+function:
+ aliases: [highlight]
+ returnType: template.HTML
+ signatures: ['transform.Highlight INPUT LANG [OPTIONS]']
+namespace: transform
+relatedFunctions:
+ - transform.CanHighlight
+ - transform.Highlight
+ - transform.HighlightCodeBlock
+aliases: [/functions/highlight]
toc: true
---
+
The `highlight` function uses the [Chroma] syntax highlighter, supporting over 200 languages with more than 40 available styles.
## Arguments
diff --git a/docs/content/en/functions/transform/HighlightCodeBlock.md b/docs/content/en/functions/transform/HighlightCodeBlock.md
new file mode 100644
index 00000000000..fa70456418f
--- /dev/null
+++ b/docs/content/en/functions/transform/HighlightCodeBlock.md
@@ -0,0 +1,43 @@
+---
+title: transform.HighlightCodeBlock
+description: Highlights code received in context within a code block render hook.
+categories: [functions]
+keywords: []
+menu:
+ docs:
+ parent: functions
+function:
+ aliases: []
+ returnType: highlight.HighlightResult
+ signatures: ['transform.HighlightCodeBlock CONTEXT [OPTIONS]']
+relatedFunctions:
+ - transform.CanHighlight
+ - transform.Highlight
+ - transform.HighlightCodeBlock
+---
+
+This function is only useful within a code block render hook.
+
+Given the context passed into a code block render hook, `transform.HighlightCodeBlock` returns a `HighlightResult` object with two methods.
+
+.Wrapped
+: (`template.HTML`) Returns highlighted code wrapped in `
`, `
`, and `` elements. This is identical to the value returned by the transform.Highlight function.
+
+.Inner
+: (`template.HTML`) Returns highlighted code without any wrapping elements, allowing you to create your own wrapper.
+
+
+```go-html-template
+{{ $result := transform.HighlightCodeBlock . }}
+{{ $result.Wrapped }}
+```
+
+To override the default [highlighting options]:
+
+```go-html-template
+{{ $options := merge .Options (dict "linenos" true) }}
+{{ $result := transform.HighlightCodeBlock . $options }}
+{{ $result.Wrapped }}
+```
+
+[highlighting options]: /functions/transform/highlight/#options
diff --git a/docs/content/en/functions/markdownify.md b/docs/content/en/functions/transform/Markdownify.md
similarity index 80%
rename from docs/content/en/functions/markdownify.md
rename to docs/content/en/functions/transform/Markdownify.md
index 9f1f3329e1f..b0be902ce9d 100644
--- a/docs/content/en/functions/markdownify.md
+++ b/docs/content/en/functions/transform/Markdownify.md
@@ -1,13 +1,18 @@
---
-title: markdownify
+title: transform.Markdownify
+linkTitle: markdownify
description: Renders markdown to HTML.
-keywords: [markdown,content]
categories: [functions]
+keywords: []
menu:
docs:
parent: functions
-signature: ["markdownify INPUT"]
-relatedfuncs: []
+function:
+ aliases: [markdownify]
+ returnType: template.HTML
+ signatures: [transform.Markdownify INPUT]
+relatedFunctions: []
+aliases: [/functions/markdownify]
---
```go-html-template
diff --git a/docs/content/en/functions/plainify.md b/docs/content/en/functions/transform/Plainify.md
similarity index 60%
rename from docs/content/en/functions/plainify.md
rename to docs/content/en/functions/transform/Plainify.md
index 8767a460e84..163233d4ab1 100644
--- a/docs/content/en/functions/plainify.md
+++ b/docs/content/en/functions/transform/Plainify.md
@@ -1,13 +1,18 @@
---
-title: plainify
+title: transform.Plainify
+linkTitle: plainify
description: Returns a string with all HTML tags removed.
categories: [functions]
+keywords: []
menu:
docs:
parent: functions
-keywords: [strings]
-signature: ["plainify INPUT"]
-relatedfuncs: [jsonify]
+function:
+ aliases: [plainify]
+ returnType: string
+ signatures: [transform.Plainify INPUT]
+relatedFunctions: []
+aliases: [/functions/plainify]
---
```go-html-template
diff --git a/docs/content/en/functions/transform.Remarshal.md b/docs/content/en/functions/transform/Remarshal.md
similarity index 88%
rename from docs/content/en/functions/transform.Remarshal.md
rename to docs/content/en/functions/transform/Remarshal.md
index e1605197f1a..8f6e58247f3 100644
--- a/docs/content/en/functions/transform.Remarshal.md
+++ b/docs/content/en/functions/transform/Remarshal.md
@@ -2,11 +2,19 @@
title: transform.Remarshal
description: Marshals a string of serialized data, or a map, into a string of serialized data in the specified format.
categories: [functions]
+keywords: []
menu:
docs:
parent: functions
-keywords: []
-signature: [ transform.Remarshal FORMAT INPUT ]
+function:
+ aliases: []
+ returnType: string
+ signatures: [transform.Remarshal FORMAT INPUT]
+relatedFunctions:
+ - encoding.Jsonify
+ - transform.Remarshal
+ - transform.Unmarshal
+aliases: [/functions/transform.remarshal]
---
The FORMAT must be one of `json`, `toml`, `yaml`, or `xml`. If the INPUT is a string of serialized data, it must be valid JSON, TOML, YAML, or XML.
diff --git a/docs/content/en/functions/transform.Unmarshal.md b/docs/content/en/functions/transform/Unmarshal.md
similarity index 82%
rename from docs/content/en/functions/transform.Unmarshal.md
rename to docs/content/en/functions/transform/Unmarshal.md
index 7d0920da8fb..ab32d13de86 100644
--- a/docs/content/en/functions/transform.Unmarshal.md
+++ b/docs/content/en/functions/transform/Unmarshal.md
@@ -1,12 +1,22 @@
---
title: transform.Unmarshal
-description: "`transform.Unmarshal` (alias `unmarshal`) parses the input and converts it into a map or an array. Supported formats are JSON, TOML, YAML, XML and CSV."
+description: Parses the input and converts it into a map or an array. Supported formats are JSON, TOML, YAML, XML and CSV.
categories: [functions]
+keywords: []
menu:
docs:
parent: functions
-keywords: []
-signature: ["RESOURCE or STRING | transform.Unmarshal [OPTIONS]"]
+function:
+ aliases: [unmarshal]
+ returnType: any
+ signatures:
+ - RESOURCE or STRING | transform.Unmarshal [OPTIONS]
+ - RESOURCE or STRING | unmarshal [OPTIONS]
+relatedFunctions:
+ - encoding.Jsonify
+ - transform.Remarshal
+ - transform.Unmarshal
+aliases: [/functions/transform.unmarshal]
---
The function accepts either a `Resource` created in [Hugo Pipes](/hugo-pipes/) or via [Page Bundles](/content-management/page-bundles/), or simply a string. The two examples below will produce the same map:
diff --git a/docs/content/en/functions/truncate.md b/docs/content/en/functions/truncate.md
deleted file mode 100644
index cf38a2dfda8..00000000000
--- a/docs/content/en/functions/truncate.md
+++ /dev/null
@@ -1,23 +0,0 @@
----
-title: truncate
-description: Truncates a text to a max length without cutting words or leaving unclosed HTML tags.
-categories: [functions]
-menu:
- docs:
- parent: functions
-keywords: [strings]
-signature:
- - "truncate SIZE [ELLIPSIS] INPUT"
- - "strings.Truncate SIZE [ELLIPSIS] INPUT"
-relatedfuncs: []
----
-
-Since Go templates are HTML-aware, `truncate` will intelligently handle normal strings vs HTML strings:
-
-```go-html-template
-{{ "Keep my HTML" | safeHTML | truncate 10 }}` → Keep my …`
-```
-
-{{% note %}}
-If you have a raw string that contains HTML tags you want to remain treated as HTML, you will need to convert the string to HTML using the [`safeHTML` template function](/functions/safehtml) before sending the value to truncate. Otherwise, the HTML tags will be escaped when passed through the `truncate` function.
-{{% /note %}}
diff --git a/docs/content/en/functions/uniq.md b/docs/content/en/functions/uniq.md
deleted file mode 100644
index aecdccf9542..00000000000
--- a/docs/content/en/functions/uniq.md
+++ /dev/null
@@ -1,15 +0,0 @@
----
-title: uniq
-description: Takes in a slice or array and returns a slice with duplicate elements removed.
-categories: [functions]
-menu:
- docs:
- parent: functions
-keywords: [multilingual,i18n,urls]
-signature: [uniq SET]
----
-
-
-```go-html-template
-{{ slice 1 3 2 1 | uniq }} → [1 3 2]
-```
diff --git a/docs/content/en/functions/unix.md b/docs/content/en/functions/unix.md
deleted file mode 100644
index 60fae9248a0..00000000000
--- a/docs/content/en/functions/unix.md
+++ /dev/null
@@ -1,30 +0,0 @@
----
-title: .Unix
-description: Converts a time.Time value to the number of seconds elapsed since the Unix epoch, excluding leap seconds. The Unix epoch is 00:00:00 UTC on 1 January 1970.
-keywords: [dates,time]
-categories: [functions]
-menu:
- docs:
- parent: functions
-signature: [".Unix",".UnixMilli",".UnixMicro",".UnixNano"]
-relatedfuncs: [Format,dateFormat,now,time]
----
-
-The `Milli`, `Micro`, and `Nano` variants return the number of milliseconds, microseconds, and nanoseconds (respectively) elapsed since the Unix epoch.
-
-```go-html-template
-.Date.Unix --> 1637259694
-.ExpiryDate.Unix --> 1672559999
-.Lastmod.Unix --> 1637361786
-.PublishDate.Unix --> 1637421261
-
-("1970-01-01T00:00:00-00:00" | time.AsTime).Unix --> 0
-("1970-01-01T00:00:42-00:00" | time.AsTime).Unix --> 42
-("1970-04-11T01:48:29-08:00" | time.AsTime).Unix --> 8675309
-("2026-05-02T20:09:31-07:00" | time.AsTime).Unix --> 1777777771
-
-now.Unix --> 1637447841
-now.UnixMilli --> 1637447841347
-now.UnixMicro --> 1637447841347378
-now.UnixNano --> 1637447841347378799
-```
diff --git a/docs/content/en/functions/abslangurl.md b/docs/content/en/functions/urls/AbsLangURL.md
similarity index 88%
rename from docs/content/en/functions/abslangurl.md
rename to docs/content/en/functions/urls/AbsLangURL.md
index 2e1996f7ef2..ad73bbff08b 100644
--- a/docs/content/en/functions/abslangurl.md
+++ b/docs/content/en/functions/urls/AbsLangURL.md
@@ -1,12 +1,22 @@
---
-title: absLangURL
+title: urls.AbsLangURL
+linkTitle: absLangURL
description: Returns an absolute URL with a language prefix, if any.
categories: [functions]
+keywords: []
menu:
docs:
parent: functions
-keywords: [urls, multilingual,i18n]
-signature: ["absLangURL INPUT"]
+function:
+ aliases: [absLangURL]
+ returnType: template.HTML
+ signatures: [urls.AbsLangURL INPUT]
+relatedFunctions:
+ - urls.AbsLangURL
+ - urls.AbsURL
+ - urls.RelLangURL
+ - urls.RelURL
+aliases: [/functions/abslangurl]
---
Use this function with both monolingual and multilingual configurations. The URL returned by this function depends on:
diff --git a/docs/content/en/functions/absurl.md b/docs/content/en/functions/urls/AbsURL.md
similarity index 84%
rename from docs/content/en/functions/absurl.md
rename to docs/content/en/functions/urls/AbsURL.md
index efea2df75b2..bb6816f577e 100644
--- a/docs/content/en/functions/absurl.md
+++ b/docs/content/en/functions/urls/AbsURL.md
@@ -1,12 +1,22 @@
---
-title: absURL
+title: urls.AbsURL
+linkTitle: absURL
description: Returns an absolute URL.
categories: [functions]
+keywords: []
menu:
docs:
parent: functions
-keywords: [urls]
-signature: ["absURL INPUT"]
+function:
+ aliases: [absURL]
+ returnType: template.html
+ signatures: [urls.AbsURL INPUT]
+relatedFunctions:
+ - urls.AbsLangURL
+ - urls.AbsURL
+ - urls.RelLangURL
+ - urls.RelURL
+aliases: [/functions/absurl]
---
With multilingual configurations, use the [`absLangURL`] function instead. The URL returned by this function depends on:
@@ -34,7 +44,7 @@ With `baseURL = https://example.org/docs/`
{{ absURL "style.css" }} → https://example.org/docs/style.css
```
-### Input begins with a slash
+#### Input begins with a slash
If the input begins with a slash, the resulting URL will be incorrect when the `baseURL` includes a subdirectory. With a leading slash, the function returns a URL relative to the protocol+host section of the `baseURL`.
@@ -58,4 +68,4 @@ With `baseURL = https://example.org/docs/`
The last three examples are not desirable in most situations. As a best practice, never include a leading slash when using this function.
{{% /note %}}
-[`absLangURL`]: /functions/abslangurl/
+[`absLangURL`]: /functions/urls/abslangurl/
diff --git a/docs/content/en/functions/anchorize.md b/docs/content/en/functions/urls/Anchorize.md
similarity index 81%
rename from docs/content/en/functions/anchorize.md
rename to docs/content/en/functions/urls/Anchorize.md
index 91d6b4fe7c4..15efe9a5ed9 100644
--- a/docs/content/en/functions/anchorize.md
+++ b/docs/content/en/functions/urls/Anchorize.md
@@ -1,13 +1,20 @@
---
-title: anchorize
+title: urls.Anchorize
+linkTitle: anchorize
description: Takes a string and sanitizes it the same way as the [`defaultMarkdownHandler`](/getting-started/configuration-markup#default-configuration) does for markdown headers.
categories: [functions]
+keywords: []
menu:
docs:
parent: functions
-keywords: [markdown,strings]
-signature: ["anchorize INPUT"]
-relatedfuncs: [humanize]
+function:
+ aliases: [anchorize]
+ returnType: string
+ signatures: [urls.Anchorize INPUT]
+relatedFunctions:
+ - urls.Anchorize
+ - urls.URLize
+aliases: [/functions/anchorize]
---
If [Goldmark](/getting-started/configuration-markup#goldmark) is set as `defaultMarkdownHandler`, the sanitizing logic adheres to the setting [`markup.goldmark.parser.autoHeadingIDType`](/getting-started/configuration-markup#goldmark).
diff --git a/docs/content/en/functions/urls.JoinPath.md b/docs/content/en/functions/urls/JoinPath.md
similarity index 75%
rename from docs/content/en/functions/urls.JoinPath.md
rename to docs/content/en/functions/urls/JoinPath.md
index f116323677e..41adf7ee795 100644
--- a/docs/content/en/functions/urls.JoinPath.md
+++ b/docs/content/en/functions/urls/JoinPath.md
@@ -2,11 +2,18 @@
title: urls.JoinPath
description: Joins the provided elements into a URL string and cleans the result of any ./ or ../ elements. If the argument list is empty, JoinPath returns an empty string.
categories: [functions]
+keywords: []
menu:
docs:
parent: functions
-keywords: [urls,path,join]
-signature: ["urls.JoinPath ELEMENT..."]
+function:
+ aliases: []
+ returnType: string
+ signatures: [urls.JoinPath ELEMENT...]
+relatedFunctions:
+ - path.Join
+ - urls.JoinPath
+aliases: [/functions/urls.joinpath]
---
```go-html-template
@@ -22,4 +29,4 @@ signature: ["urls.JoinPath ELEMENT..."]
Unlike the [`path.Join`] function, `urls.JoinPath` retains consecutive leading slashes.
-[`path.Join`]: /functions/path.join/
+[`path.Join`]: /functions/path/join
diff --git a/docs/content/en/functions/urls.Parse.md b/docs/content/en/functions/urls/Parse.md
similarity index 86%
rename from docs/content/en/functions/urls.Parse.md
rename to docs/content/en/functions/urls/Parse.md
index b2d781e7f0f..17c924d5125 100644
--- a/docs/content/en/functions/urls.Parse.md
+++ b/docs/content/en/functions/urls/Parse.md
@@ -2,11 +2,16 @@
title: urls.Parse
description: Parses a URL into a URL structure.
categories: [functions]
+keywords: []
menu:
docs:
parent: functions
-keywords: [urls]
-signature: ["urls.Parse URL"]
+function:
+ aliases: []
+ returnType: URL
+ signatures: [urls.Parse URL]
+relatedFunctions: []
+aliases: [/functions/urls.parse]
---
The `urls.Parse` function parses a URL into a [URL structure](https://godoc.org/net/url#URL). The URL may be relative (a path, without a host) or absolute (starting with a [scheme]). Hugo throws an error when parsing an invalid URL.
diff --git a/docs/content/en/functions/ref.md b/docs/content/en/functions/urls/Ref.md
similarity index 87%
rename from docs/content/en/functions/ref.md
rename to docs/content/en/functions/urls/Ref.md
index 2d05ca42763..908fd6ca8cb 100644
--- a/docs/content/en/functions/ref.md
+++ b/docs/content/en/functions/urls/Ref.md
@@ -1,13 +1,20 @@
---
-title: ref
+title: urls.Ref
+linkTitle: ref
description: Returns the absolute permalink to a page.
categories: [functions]
+keywords: []
menu:
docs:
parent: functions
-keywords: [cross references, anchors]
-signature: ["ref . PAGE"]
-relatedfuncs: [relref]
+function:
+ aliases: [ref]
+ returnType: template.HTML
+ signatures: [urls.Ref . PAGE]
+relatedFunctions:
+ - urls.Ref
+ - urls.RelRef
+aliases: [/functions/ref]
---
This function takes two arguments:
diff --git a/docs/content/en/functions/relLangURL.md b/docs/content/en/functions/urls/RelLangURL.md
similarity index 86%
rename from docs/content/en/functions/relLangURL.md
rename to docs/content/en/functions/urls/RelLangURL.md
index 78b823c239c..b8850c71dd7 100644
--- a/docs/content/en/functions/relLangURL.md
+++ b/docs/content/en/functions/urls/RelLangURL.md
@@ -1,12 +1,22 @@
---
-title: relLangURL
+title: urls.RelLangURL
+linkTitle: relLangURL
description: Returns a relative URL with a language prefix, if any.
categories: [functions]
+keywords: []
menu:
docs:
parent: functions
-keywords: [urls, multilingual,i18n]
-signature: ["relLangURL INPUT"]
+function:
+ aliases: [relLangURL]
+ returnType: template.HTML
+ signatures: [urls.RelLangURL INPUT]
+relatedFunctions:
+ - urls.AbsLangURL
+ - urls.AbsURL
+ - urls.RelLangURL
+ - urls.RelURL
+aliases: [/functions/rellangurl]
---
Use this function with both monolingual and multilingual configurations. The URL returned by this function depends on:
@@ -37,7 +47,7 @@ With `baseURL = https://example.org/docs/`
{{ relLangURL "style.css" }} → /docs/en/style.css
```
-### Input begins with a slash
+#### Input begins with a slash
If the input begins with a slash, the resulting URL will be incorrect when the `baseURL` includes a subdirectory. With a leading slash, the function returns a URL relative to the protocol+host section of the `baseURL`.
diff --git a/docs/content/en/functions/relref.md b/docs/content/en/functions/urls/RelRef.md
similarity index 88%
rename from docs/content/en/functions/relref.md
rename to docs/content/en/functions/urls/RelRef.md
index 98ad724f7b5..1ff213b70b1 100644
--- a/docs/content/en/functions/relref.md
+++ b/docs/content/en/functions/urls/RelRef.md
@@ -1,13 +1,20 @@
---
-title: relref
+title: urls.RelRef
+linkTitle: relref
description: Returns the relative permalink to a page.
categories: [functions]
+keywords: []
menu:
docs:
parent: functions
-keywords: [cross references, anchors]
-signature: ["relref . PAGE"]
-relatedfuncs: [ref]
+function:
+ aliases: [relref]
+ returnType: template.HTML
+ signatures: [urls.RelRef . PAGE]
+relatedFunctions:
+ - urls.Ref
+ - urls.RelRef
+aliases: [/functions/relref]
---
This function takes two arguments:
diff --git a/docs/content/en/functions/relurl.md b/docs/content/en/functions/urls/RelURL.md
similarity index 82%
rename from docs/content/en/functions/relurl.md
rename to docs/content/en/functions/urls/RelURL.md
index c8278c9df35..fa1f9af7355 100644
--- a/docs/content/en/functions/relurl.md
+++ b/docs/content/en/functions/urls/RelURL.md
@@ -1,12 +1,22 @@
---
-title: relURL
+title: urls.RelURL
+linkTitle: relURL
description: Returns a relative URL.
categories: [functions]
+keywords: []
menu:
docs:
parent: functions
-keywords: [urls]
-signature: ["relURL INPUT"]
+function:
+ aliases: [relURL]
+ returnType: template.HTML
+ signatures: [urls.RelURL INPUT]
+relatedFunctions:
+ - urls.AbsLangURL
+ - urls.AbsURL
+ - urls.RelLangURL
+ - urls.RelURL
+aliases: [/functions/relurl]
---
With multilingual configurations, use the [`relLangURL`] function instead. The URL returned by this function depends on:
@@ -34,7 +44,7 @@ With `baseURL = https://example.org/docs/`
{{ relURL "style.css" }} → /docs/style.css
```
-### Input begins with a slash
+#### Input begins with a slash
If the input begins with a slash, the resulting URL will be incorrect when the `baseURL` includes a subdirectory. With a leading slash, the function returns a URL relative to the protocol+host section of the `baseURL`.
@@ -58,4 +68,4 @@ With `baseURL = https://example.org/docs/`
The last three examples are not desirable in most situations. As a best practice, never include a leading slash when using this function.
{{% /note %}}
-[`relLangURL`]: /functions/rellangurl/
+[`relLangURL`]: /functions/urls/rellangurl/
diff --git a/docs/content/en/functions/urlize.md b/docs/content/en/functions/urls/URLize.md
similarity index 87%
rename from docs/content/en/functions/urlize.md
rename to docs/content/en/functions/urls/URLize.md
index 7a9cf25e8db..3c80a92f807 100644
--- a/docs/content/en/functions/urlize.md
+++ b/docs/content/en/functions/urls/URLize.md
@@ -1,13 +1,20 @@
---
-title: urlize
+title: urls.URLize
+linkTitle: urlize
description: Takes a string, sanitizes it for usage in URLs, and converts spaces to hyphens.
categories: [functions]
+keywords: []
menu:
docs:
parent: functions
-keywords: [urls,strings]
-signature: ["urlize INPUT"]
-relatedfuncs: []
+function:
+ aliases: [urlize]
+ returnType: string
+ signatures: [urls.URLize INPUT]
+relatedFunctions:
+ - urls.Anchorize
+ - urls.URLize
+aliases: [/functions/urlize]
---
The following examples pull from a content file with the following front matter:
diff --git a/docs/content/en/getting-started/configuration-markup.md b/docs/content/en/getting-started/configuration-markup.md
index dca2b3c5219..02c4ea9986e 100644
--- a/docs/content/en/getting-started/configuration-markup.md
+++ b/docs/content/en/getting-started/configuration-markup.md
@@ -12,21 +12,47 @@ slug: configuration-markup
toc: true
---
-## Default configuration
+## Default handler
-See [Goldmark](#goldmark) for settings related to the default markdown handler in Hugo.
+By default, Hugo uses [Goldmark] to render markdown to HTML.
-Below are all markup related configuration in Hugo with their default settings:
+{{< code-toggle file=hugo copy=false >}}
+[markup]
+defaultMarkdownHandler = 'goldmark'
+{{< /code-toggle >}}
-{{< code-toggle config="markup" />}}
+Files with the `.md` or `.markdown` extension are processed as markdown, provided that you have not specified a different [content format] using the `markup` field in front matter.
-**See each section below for details.**
+To use a different renderer for markdown files, specify one of `asciidocext`, `org`, `pandoc`, or `rst` in your site configuration.
-## Goldmark
+defaultMarkdownHandler|Description
+:--|:--
+`asciidocext`|[AsciiDoc]
+`goldmark`|[Goldmark]
+`org`|[Emacs Org Mode]
+`pandoc`|[Pandoc]
+`rst`|[reStructuredText]
+
+To use Asciidoc, Pandoc, or reStructuredText you must install the relevant renderer and update your [security policy].
+
+{{% note %}}
+Unless you need a unique capability provided by one of the alternate markdown handlers, we strongly recommend that you use the default setting. Goldmark is fast, well maintained, conforms to the [CommonMark] specification, and is compatible with [GitHub Flavored Markdown] (GFM).
+
+[commonmark]: https://spec.commonmark.org/0.30/
+[github flavored markdown]: https://github.github.com/gfm/
+{{% /note %}}
-[Goldmark](https://github.com/yuin/goldmark/) is from Hugo 0.60 the default library used for Markdown. It's fast, it's [CommonMark](https://spec.commonmark.org/current/) compliant and it's very flexible.
+[asciidoc]: https://asciidoc.org/
+[content format]: /content-management/formats/#list-of-content-formats
+[emacs org mode]: https://orgmode.org/
+[goldmark]: https://github.com/yuin/goldmark/
+[pandoc]: https://pandoc.org/
+[restructuredtext]: https://docutils.sourceforge.io/rst.html
+[security policy]: /about/security-model/#security-policy
-This is the default configuration:
+## Goldmark
+
+This is the default configuration for the Goldmark markdown renderer:
{{< code-toggle config="markup.goldmark" />}}
@@ -41,7 +67,21 @@ unsafe
: By default, Goldmark does not render raw HTML and potentially dangerous links. If you have lots of inline HTML and/or JavaScript, you may need to turn this on.
typographer
-: This extension substitutes punctuations with typographic entities like [smartypants](https://daringfireball.net/projects/smartypants/).
+: The typographer extension replaces certain character combinations with HTML entities as specified below:
+
+Markdown|Replaced by|Description
+:--|:--|:--
+`...`|`…`|horizontal ellipsis
+`'`|`’`|apostrophe
+`--`|`–`|en dash
+`---`|`—`|em dash
+`«`|`«`|left angle quote
+`“`|`“`|left double quote
+`‘`|`‘`|left single quote
+`»`|`»`|right angle quote
+`”`|`”`|right double quote
+`’`|`’`|right single quote
+
attribute
: Enable custom attribute support for titles and blocks by adding attribute lists inside single curly brackets (`{.myclass class="class1 class2" }`) and placing it _after the Markdown element it decorates_, on the same line for titles and on a new line directly below for blocks.
@@ -80,7 +120,71 @@ Note that attributes in [code fences](/content-management/syntax-highlighting/#h
````
autoHeadingIDType ("github")
-: The strategy used for creating auto IDs (anchor names). Available types are `github`, `github-ascii` and `blackfriday`. `github` produces GitHub-compatible IDs, `github-ascii` will drop any non-Ascii characters after accent normalization, and `blackfriday` will make the IDs compatible with Blackfriday, the default Markdown engine before Hugo 0.60. Note that if Goldmark is your default Markdown engine, this is also the strategy used in the [anchorize](/functions/anchorize/) template func.
+: The strategy used for creating auto IDs (anchor names). Available types are `github`, `github-ascii` and `blackfriday`. `github` produces GitHub-compatible IDs, `github-ascii` will drop any non-Ascii characters after accent normalization, and `blackfriday` will make the IDs compatible with Blackfriday, the default Markdown engine before Hugo 0.60. Note that if Goldmark is your default Markdown engine, this is also the strategy used in the [anchorize](/functions/urls/anchorize) template func.
+
+## Asciidoc
+
+This is the default configuration for the AsciiDoc markdown renderer:
+
+{{< code-toggle config="markup.asciidocExt" />}}
+
+attributes
+: (`map`) Variables to be referenced in your AsciiDoc file. This is a list of variable name/value maps. See Asciidoctor’s [attributes].
+
+[attributes]: https://asciidoctor.org/docs/asciidoc-syntax-quick-reference/#attributes-and-substitutions
+
+backend:
+: (`string`) Don’t change this unless you know what you are doing.
+
+extensions
+: (`[]string`) Possible extensions are `asciidoctor-html5s`, `asciidoctor-bibtex`, `asciidoctor-diagram`, `asciidoctor-interdoc-reftext`, `asciidoctor-katex`, `asciidoctor-latex`, `asciidoctor-mathematical`, and `asciidoctor-question`.
+
+failureLevel
+: (`string`) The minimum logging level that triggers a non-zero exit code (failure).
+
+noHeaderOrFooter
+: (`bool`) Output an embeddable document, which excludes the header, the footer, and everything outside the body of the document. Don’t change this unless you know what you are doing.
+
+preserveTOC
+: (`bool`) By default, Hugo removes the table of contents generated by Asciidoctor and provides it through the built-in variable `.TableOfContents` to enable further customization and better integration with the various Hugo themes. This option can be set to true to preserve Asciidoctor’s TOC in the generated page.
+
+safeMode
+: (`string`) Safe mode level `unsafe`, `safe`, `server`, or `secure`. Don’t change this unless you know what you are doing.
+
+sectionNumbers
+: (`bool`) Auto-number section titles.
+
+trace
+: (`bool`) Include backtrace information on errors.
+
+verbose
+: (`bool`) Verbosely print processing information and configuration file checks to stderr.
+
+workingFolderCurrent
+: (`bool`) Sets the working directory to be the same as that of the AsciiDoc file being processed, so that [include] will work with relative paths. This setting uses the asciidoctor cli parameter --base-dir and attribute outdir=. For rendering diagrams with [asciidoctor-diagram], `workingFolderCurrent` must be set to `true`.
+
+[asciidoctor-diagram]: https://asciidoctor.org/docs/asciidoctor-diagram/
+[include]: https://asciidoctor.org/docs/asciidoc-syntax-quick-reference/#include-files
+
+Notice that for security concerns only extensions that do not have path separators (either `\`, `/` or `.`) are allowed. That means that extensions can only be invoked if they are in the Ruby's `$LOAD_PATH` (ie. most likely, the extension has been installed by the user). Any extension declared relative to the website's path will not be accepted.
+
+Example of how to set extensions and attributes:
+
+```yml
+[markup.asciidocExt]
+ extensions = ["asciidoctor-html5s", "asciidoctor-diagram"]
+ workingFolderCurrent = true
+ [markup.asciidocExt.attributes]
+ my-base-url = "https://example.com/"
+ my-attribute-name = "my value"
+```
+
+In a complex Asciidoctor environment it is sometimes helpful to debug the exact call to your external helper with all
+parameters. Run Hugo with `-v`. You will get an output like
+
+```txt
+INFO 2019/12/22 09:08:48 Rendering book-as-pdf.adoc with C:\Ruby26-x64\bin\asciidoctor.bat using asciidoc args [--no-header-footer -r asciidoctor-html5s -b html5s -r asciidoctor-diagram --base-dir D:\prototypes\hugo_asciidoc_ddd\docs -a outdir=D:\prototypes\hugo_asciidoc_ddd\build -] ...
+```
## Highlight
@@ -110,6 +214,6 @@ endLevel
ordered
: If `true`, generates an ordered list instead of an unordered list.
-## Markdown render hooks
+## Render hooks
See [Markdown Render Hooks](/templates/render-hooks/).
diff --git a/docs/content/en/getting-started/configuration.md b/docs/content/en/getting-started/configuration.md
index d210765ab26..2187540ae64 100644
--- a/docs/content/en/getting-started/configuration.md
+++ b/docs/content/en/getting-started/configuration.md
@@ -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 >}}
@@ -74,28 +74,56 @@ foo = "bar"
Considering the structure above, when running `hugo --environment staging`, Hugo will use every setting from `config/_default` and merge `staging`'s on top of those.
-Let's take an example to understand this better. Let's say you are using Google Analytics for your website. This requires you to specify `googleAnalytics = "G-XXXXXXXX"` in `hugo.toml`. Now consider the following scenario:
-- You don't want the Analytics code to be loaded in development i.e. in your `localhost`
-- You want to use separate googleAnalytics IDs for your production & staging environments (say):
- - `G-PPPPPPPP` for production
- - `G-SSSSSSSS` for staging
+Let's take an example to understand this better. Let's say you are using Google Analytics for your website. This requires you to specify a [Google tag ID] in your site configuration:
-This is how you need to configure your `hugo.toml` files considering the above scenario:
-1. In `_default/hugo.toml` you don't need to mention `googleAnalytics` parameter at all. This ensures that no Google Analytics code is loaded in your development server i.e. when you run `hugo server`. This works since, by default Hugo sets `Environment=development` when you run `hugo server` which uses the configuration files from `_default` folder
-2. In `production/hugo.toml` you just need to have one line:
+[Google tag ID]: https://support.google.com/tagmanager/answer/12326985?hl=en
- ```googleAnalytics = "G-PPPPPPPP"```
+{{< code-toggle file=hugo copy=false >}}
+[services.googleAnalytics]
+ID = 'G-XXXXXXXXX'
+{{< /code-toggle >}}
- You don't need to mention all other parameters like `title`, `baseURL`, `theme` etc. again in this configuration file. You need to mention only those parameters which are different or new for the production environment. This is due to the fact that Hugo is going to __merge__ this on top of `_default/hugo.toml`. Now when you run `hugo` (build command), by default hugo sets `Environment=production`, so the `G-PPPPPPPP` analytics code will be there in your production website
-3. Similarly in `staging/hugo.toml` you just need to have one line:
+Now consider the following scenario:
- ```googleAnalytics = "G-SSSSSSSS"```
+1. You don't want to load the analytics code when running `hugo server`.
+2. You want to use different Google tag IDs for your production and staging environments. For example:
- Now you need to tell Hugo that you are using the staging environment. So your build command should be `hugo --environment staging` which will load the `G-SSSSSSSS` analytics code in your staging website
+ - `G-PPPPPPPPP` for production
+ - `G-SSSSSSSSS` for staging
-{{% note %}}
-Default environments are __development__ with `hugo server` and __production__ with `hugo`.
-{{%/ note %}}
+To satisfy these requirements, configure your site as follows:
+
+1. `config/_default/hugo.toml`
+
+ Exclude the `services.googleAnalytics` section. This will prevent loading of the analytics code when you run `hugo server`.
+
+ By default, Hugo sets its `environment` to `development` when running `hugo server`. In the absence of a `config/development` directory, Hugo uses the `config/_default` directory.
+
+2. `config/production/hugo.toml`
+
+ Include this section only:
+
+ {{< code-toggle file=hugo copy=false >}}
+ [services.googleAnalytics]
+ ID = 'G-PPPPPPPPP'
+ {{< /code-toggle >}}
+
+ You do not need to include other parameters in this file. Include only those parameters that are specific to your production environment. Hugo will merge these parameters with the default configuration.
+
+ By default, Hugo sets its `environment` to `production` when running `hugo`. The analytics code will use the `G-PPPPPPPPP` tag ID.
+
+3. `config/staging/hugo.toml`
+
+ Include this section only:
+
+ {{< code-toggle file=hugo copy=false >}}
+ [services.googleAnalytics]
+ ID = 'G-SSSSSSSSS'
+ {{< /code-toggle >}}
+
+ You do not need to include other parameters in this file. Include only those parameters that are specific to your staging environment. Hugo will merge these parameters with the default configuration.
+
+ To build your staging site, run `hugo --environment staging`. The analytics code will use the `G-SSSSSSSSS` tag ID.
## Merge configuration from themes
@@ -400,7 +428,7 @@ URL to be used as a placeholder when a page reference cannot be found in `ref` o
Removes [non-spacing marks](https://www.compart.com/en/unicode/category/Mn) from [composite characters](https://en.wikipedia.org/wiki/Precomposed_character) in content paths.
```text
-content/post/hügó.md --> https://example.org/post/hugo/
+content/post/hügó.md → https://example.org/post/hugo/
```
### rssLimit
@@ -449,7 +477,7 @@ Timeout for generating page contents, specified as a [duration](https://pkg.go.d
### timeZone
-The time zone (or location), e.g. `Europe/Oslo`, used to parse front matter dates without such information and in the [`time` function](/functions/time/). The list of valid values may be system dependent, but should include `UTC`, `Local`, and any location in the [IANA Time Zone database](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones).
+The time zone (or location), e.g. `Europe/Oslo`, used to parse front matter dates without such information and in the [`time`] function. The list of valid values may be system dependent, but should include `UTC`, `Local`, and any location in the [IANA Time Zone database](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones).
### title
@@ -527,8 +555,6 @@ useResourceCacheWhen
The `build.cachebusters` configuration option was added to support development using Tailwind 3.x's JIT compiler where a `build` configuration may look like this:
-
-
{{< code-toggle file="hugo" >}}
[build]
[build.buildStats]
@@ -616,7 +642,7 @@ status = 404
## Configure title case
-Set `titleCaseStyle` to specify the title style used by the [title](/functions/title/) template function and the automatic section titles in Hugo.
+Set `titleCaseStyle` to specify the title style used by the [title](/functions/strings/title) template function and the automatic section titles in Hugo.
Can be one of:
@@ -684,10 +710,6 @@ To set configuration parameters, prefix the name with `HUGO_PARAMS_`
If you are using snake_cased variable names, the above will not work. Hugo determines the delimiter to use by the first character after `HUGO`. This allows you to define environment variables on the form `HUGOxPARAMSxAPI_KEY=abcdefgh`, using any [allowed](https://stackoverflow.com/questions/2821043/allowed-characters-in-linux-environment-variable-names#:~:text=So%20names%20may%20contain%20any,not%20begin%20with%20a%20digit.) delimiter.
-{{< todo >}}
-Test and document setting parameters via JSON env var.
-{{< /todo >}}
-
## Ignore content and data files when rendering
**Note:** This works, but we recommend you use the newer and more powerful [includeFiles and excludeFiles](/hugo-modules/configuration/#module-configuration-mounts) mount options.
@@ -799,7 +821,7 @@ dir
[`.Site.Params`]: /variables/site/
[directory structure]: /getting-started/directory-structure
-[json]: https://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf "Specification for JSON, JavaScript Object Notation"
+[json]: https://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf
[lookup order]: /templates/lookup-order/
[Output Formats]: /templates/output-formats/
[templates]: /templates/
@@ -821,3 +843,6 @@ If this is not set, Hugo will use, in order of preference:
1. In a `hugo_cache_$USER` directory below the OS temp dir.
If you want to know the current value of `cacheDir`, you can run `hugo config`, e.g: `hugo config | grep cachedir`.
+
+
+[`time`]: /functions/time/astime
diff --git a/docs/content/en/getting-started/glossary.md b/docs/content/en/getting-started/glossary.md
index 834f72ec5cd..759cb1cd132 100644
--- a/docs/content/en/getting-started/glossary.md
+++ b/docs/content/en/getting-started/glossary.md
@@ -64,6 +64,10 @@ A markup language for creating content. Typically markdown, but may also be HTML
A classification of content inferred from the top-level directory name or the `type` set in [front matter](#front-matter). Pages in the root of the content directory, including the home page, are of type "page". Accessed via `.Page.Type` in [templates](#template). See [details](/content-management/types/).
+### content view
+
+A template called with the `.Page.Render` method. See [details](/templates/views/).
+
### context
Represented by a period "." within a [template action](#template-action), context is the current location in a data structure. For example, while iterating over a [collection](#collection) of pages, the context within each iteration is the page's data structure. The context received by each template depends on template type and/or how it was called. See [details](/templates/introduction/#the-dot).
@@ -88,6 +92,10 @@ Used within a [template action](#template-action), a function takes one or more
Metadata at the beginning of each content page, separated from the content by format-specific delimiters. See [details](/content-management/front-matter/).
+### identifier
+
+A string that represents a variable, method, object, or field. It must conform to Go's [language specification](https://go.dev/ref/spec#Identifiers), beginning with a letter or underscore, followed by zero or more letters, digits, or underscores.
+
### int
See [integer](#integer).
@@ -250,7 +258,7 @@ A packaged combination of [archetypes](#archetype), assets, content, data, [temp
### token
-An identifier within a format string, beginning with a colon and replaced with a value when rendered. For example, use tokens in format strings for both [permalinks](/content-management/urls/#permalinks) and [dates](/functions/dateformat/#datetime-formatting-layouts).
+An identifier within a format string, beginning with a colon and replaced with a value when rendered. For example, use tokens in format strings for both [permalinks](/content-management/urls/#permalinks) and [dates](/functions/time/format/#localization).
### type
diff --git a/docs/content/en/hosting-and-deployment/hosting-on-firebase.md b/docs/content/en/hosting-and-deployment/hosting-on-firebase.md
index 3b1ba9dcd4b..c58f4b7520e 100644
--- a/docs/content/en/hosting-and-deployment/hosting-on-firebase.md
+++ b/docs/content/en/hosting-and-deployment/hosting-on-firebase.md
@@ -47,26 +47,26 @@ From here:
In new versions of Firebase, some other questions apply:
-6. Set up automatic builds and deploys with GitHub?
+6. Set up automatic builds and deploys with GitHub?
Here you will be redirected to login in your GitHub account to get permissions. Confirm.
-7. For which GitHub repository would you like to set up a GitHub workflow? (format: user/repository)
+7. For which GitHub repository would you like to set up a GitHub workflow? (format: user/repository)
Include the repository you will use in the format above (Account/Repo)
Firebase script with retrieve credentials, create a service account you can later manage in your GitHub settings.
-8. Set up the workflow to run a build script before every deploy?
+8. Set up the workflow to run a build script before every deploy?
Here is your opportunity to include some commands before you run the deploy.
-9. Set up automatic deployment to your site's live channel when a PR is merged?
+9. Set up automatic deployment to your site's live channel when a PR is merged?
You can let in the default option (main)
After that Firebase has been set in your project with CI/CD. After that run:
-```
+```sh
hugo && firebase deploy
```
diff --git a/docs/content/en/hugo-modules/use-modules.md b/docs/content/en/hugo-modules/use-modules.md
index 27a1f605117..db269a5db4f 100644
--- a/docs/content/en/hugo-modules/use-modules.md
+++ b/docs/content/en/hugo-modules/use-modules.md
@@ -142,7 +142,7 @@ A common use case for a workspace is to simplify local development of a site wit
A workspace can be configured in a `*.work` file and activated with the [module.workspace](/hugo-modules/configuration/) setting, which for this use is commonly controlled via the `HUGO_MODULE_WORKSPACE` OS environment variable.
-See the [hugo.work](https://github.com/gohugoio/hugo/blob/master/hugo.work) file in the Hugo Docs repo for an example:
+See the [hugo.work](https://github.com/gohugoio/hugo/blob/master/docs/hugo.work) file in the Hugo Docs repo for an example:
```text
go 1.19
diff --git a/docs/content/en/hugo-pipes/babel.md b/docs/content/en/hugo-pipes/babel.md
index 222b5116b77..44b4e670e31 100755
--- a/docs/content/en/hugo-pipes/babel.md
+++ b/docs/content/en/hugo-pipes/babel.md
@@ -8,7 +8,7 @@ menu:
parent: hugo-pipes
weight: 70
weight: 70
-signature: ["resources.Babel RESOURCE [OPTIONS]", "babel RESOURCE [OPTIONS]"]
+signatures: ["resources.Babel RESOURCE [OPTIONS]", "babel RESOURCE [OPTIONS]"]
---
## Usage
diff --git a/docs/content/en/hugo-pipes/bundling.md b/docs/content/en/hugo-pipes/bundling.md
index 8b989943224..f3ff42f9c74 100755
--- a/docs/content/en/hugo-pipes/bundling.md
+++ b/docs/content/en/hugo-pipes/bundling.md
@@ -9,7 +9,7 @@ menu:
parent: hugo-pipes
weight: 90
weight: 90
-signature: ["resources.Concat TARGET_PATH SLICE_RESOURCES"]
+signatures: ["resources.Concat TARGET_PATH SLICE_RESOURCES"]
---
## Usage
diff --git a/docs/content/en/hugo-pipes/fingerprint.md b/docs/content/en/hugo-pipes/fingerprint.md
index bdabbe0298d..c492d4c70ac 100755
--- a/docs/content/en/hugo-pipes/fingerprint.md
+++ b/docs/content/en/hugo-pipes/fingerprint.md
@@ -9,7 +9,7 @@ menu:
parent: hugo-pipes
weight: 100
weight: 100
-signature: ["resources.Fingerprint RESOURCE [ALGORITHM]", "fingerprint RESOURCE [ALGORITHM]"]
+signatures: ["resources.Fingerprint RESOURCE [ALGORITHM]", "fingerprint RESOURCE [ALGORITHM]"]
---
## Usage
diff --git a/docs/content/en/hugo-pipes/js.md b/docs/content/en/hugo-pipes/js.md
index 86c1564cf0e..ecf6dc33f72 100644
--- a/docs/content/en/hugo-pipes/js.md
+++ b/docs/content/en/hugo-pipes/js.md
@@ -9,7 +9,7 @@ menu:
parent: hugo-pipes
weight: 60
weight: 60
-signature: ["js.Build RESOURCE [OPTIONS]"]
+signatures: ["js.Build RESOURCE [OPTIONS]"]
---
## Usage
diff --git a/docs/content/en/hugo-pipes/minification.md b/docs/content/en/hugo-pipes/minification.md
index a32ef6e6f04..74ddfaa8911 100755
--- a/docs/content/en/hugo-pipes/minification.md
+++ b/docs/content/en/hugo-pipes/minification.md
@@ -9,7 +9,7 @@ menu:
parent: hugo-pipes
weight: 80
weight: 80
-signature: ["resources.Minify RESOURCE", "minify RESOURCE"]
+signatures: ["resources.Minify RESOURCE", "minify RESOURCE"]
---
## Usage
diff --git a/docs/content/en/hugo-pipes/postcss.md b/docs/content/en/hugo-pipes/postcss.md
index 4e969caf214..2a08c7ad431 100755
--- a/docs/content/en/hugo-pipes/postcss.md
+++ b/docs/content/en/hugo-pipes/postcss.md
@@ -9,7 +9,7 @@ menu:
weight: 40
toc: true
weight: 40
-signature: ["resources.PostCSS RESOURCE [OPTIONS]", "postCSS RESOURCE [OPTIONS]"]
+signatures: ["resources.PostCSS RESOURCE [OPTIONS]", "postCSS RESOURCE [OPTIONS]"]
---
## Setup
diff --git a/docs/content/en/hugo-pipes/postprocess.md b/docs/content/en/hugo-pipes/postprocess.md
index 3b7d5c61049..4b3cb8ad41a 100755
--- a/docs/content/en/hugo-pipes/postprocess.md
+++ b/docs/content/en/hugo-pipes/postprocess.md
@@ -8,7 +8,7 @@ menu:
parent: hugo-pipes
weight: 50
weight: 50
-signature: ["resources.PostProcess RESOURCE"]
+signatures: ["resources.PostProcess RESOURCE"]
---
## Usage
diff --git a/docs/content/en/hugo-pipes/resource-from-string.md b/docs/content/en/hugo-pipes/resource-from-string.md
index f3f0cda4f40..fa472715cd1 100755
--- a/docs/content/en/hugo-pipes/resource-from-string.md
+++ b/docs/content/en/hugo-pipes/resource-from-string.md
@@ -9,7 +9,7 @@ menu:
parent: hugo-pipes
weight: 110
weight: 110
-signature: ["resources.FromString TARGET_PATH CONTENT"]
+signatures: ["resources.FromString TARGET_PATH CONTENT"]
---
## Usage
diff --git a/docs/content/en/hugo-pipes/resource-from-template.md b/docs/content/en/hugo-pipes/resource-from-template.md
index 4f34817c0dc..c1c4cb316d7 100755
--- a/docs/content/en/hugo-pipes/resource-from-template.md
+++ b/docs/content/en/hugo-pipes/resource-from-template.md
@@ -9,7 +9,7 @@ menu:
parent: hugo-pipes
weight: 120
weight: 120
-signature: ["resources.ExecuteAsTemplate TARGET_PATH CONTEXT RESOURCE"]
+signatures: ["resources.ExecuteAsTemplate TARGET_PATH CONTEXT RESOURCE"]
---
## Usage
diff --git a/docs/content/en/hugo-pipes/transpile-sass-to-css.md b/docs/content/en/hugo-pipes/transpile-sass-to-css.md
index bf3d136f15d..b09cc165bcb 100644
--- a/docs/content/en/hugo-pipes/transpile-sass-to-css.md
+++ b/docs/content/en/hugo-pipes/transpile-sass-to-css.md
@@ -9,7 +9,7 @@ menu:
parent: hugo-pipes
weight: 30
weight: 30
-signature: ["resources.ToCSS RESOURCE [OPTIONS]", "toCSS RESOURCE [OPTIONS]"]
+signatures: ["resources.ToCSS RESOURCE [OPTIONS]", "toCSS RESOURCE [OPTIONS]"]
toc: true
aliases: [/hugo-pipes/transform-to-css/]
---
diff --git a/docs/content/en/installation/common/01-editions.md b/docs/content/en/installation/_common/01-editions.md
similarity index 100%
rename from docs/content/en/installation/common/01-editions.md
rename to docs/content/en/installation/_common/01-editions.md
diff --git a/docs/content/en/installation/common/02-prerequisites.md b/docs/content/en/installation/_common/02-prerequisites.md
similarity index 100%
rename from docs/content/en/installation/common/02-prerequisites.md
rename to docs/content/en/installation/_common/02-prerequisites.md
diff --git a/docs/content/en/installation/common/03-prebuilt-binaries.md b/docs/content/en/installation/_common/03-prebuilt-binaries.md
similarity index 100%
rename from docs/content/en/installation/common/03-prebuilt-binaries.md
rename to docs/content/en/installation/_common/03-prebuilt-binaries.md
diff --git a/docs/content/en/installation/common/05-build-from-source.md b/docs/content/en/installation/_common/04-build-from-source.md
similarity index 100%
rename from docs/content/en/installation/common/05-build-from-source.md
rename to docs/content/en/installation/_common/04-build-from-source.md
diff --git a/docs/content/en/installation/common/homebrew.md b/docs/content/en/installation/_common/homebrew.md
similarity index 100%
rename from docs/content/en/installation/common/homebrew.md
rename to docs/content/en/installation/_common/homebrew.md
diff --git a/docs/content/en/installation/common/index.md b/docs/content/en/installation/_common/index.md
similarity index 100%
rename from docs/content/en/installation/common/index.md
rename to docs/content/en/installation/_common/index.md
diff --git a/docs/content/en/installation/bsd.md b/docs/content/en/installation/bsd.md
index 5fbc4bfad63..999e52ad6dd 100644
--- a/docs/content/en/installation/bsd.md
+++ b/docs/content/en/installation/bsd.md
@@ -9,11 +9,11 @@ menu:
toc: true
weight: 50
---
-{{% readfile file="/installation/common/01-editions.md" %}}
+{{% readfile file="/installation/_common/01-editions.md" %}}
-{{% readfile file="/installation/common/02-prerequisites.md" %}}
+{{% readfile file="/installation/_common/02-prerequisites.md" %}}
-{{% readfile file="/installation/common/03-prebuilt-binaries.md" %}}
+{{% readfile file="/installation/_common/03-prebuilt-binaries.md" %}}
## Repository packages
@@ -61,7 +61,7 @@ doas pkg_add hugo
[OpenBSD]: https://www.openbsd.org/
-{{% readfile file="/installation/common/05-build-from-source.md" %}}
+{{% readfile file="/installation/_common/04-build-from-source.md" %}}
## Comparison
diff --git a/docs/content/en/installation/common/04-docker.md b/docs/content/en/installation/common/04-docker.md
deleted file mode 100644
index 24f5cd942fa..00000000000
--- a/docs/content/en/installation/common/04-docker.md
+++ /dev/null
@@ -1,10 +0,0 @@
-## Docker
-
-[Erlend Klakegg Bergheim] graciously maintains [Docker images] based on images for Alpine Linux, Busybox, Debian, and Ubuntu.
-
-```sh
-docker pull klakegg/hugo
-```
-
-[Docker images]: https://hub.docker.com/r/klakegg/hugo
-[Erlend Klakegg Bergheim]: https://github.com/klakegg
diff --git a/docs/content/en/installation/linux.md b/docs/content/en/installation/linux.md
index 4056b987a63..2dbbd372007 100644
--- a/docs/content/en/installation/linux.md
+++ b/docs/content/en/installation/linux.md
@@ -9,11 +9,11 @@ menu:
toc: true
weight: 30
---
-{{% readfile file="/installation/common/01-editions.md" %}}
+{{% readfile file="/installation/_common/01-editions.md" %}}
-{{% readfile file="/installation/common/02-prerequisites.md" %}}
+{{% readfile file="/installation/_common/02-prerequisites.md" %}}
-{{% readfile file="/installation/common/03-prebuilt-binaries.md" %}}
+{{% readfile file="/installation/_common/03-prebuilt-binaries.md" %}}
## Package managers
@@ -47,7 +47,7 @@ sudo snap disconnect hugo:ssh-keys
[strictly confined]: https://snapcraft.io/docs/snap-confinement
[Snap]: https://snapcraft.io/
-{{% readfile file="/installation/common/homebrew.md" %}}
+{{% readfile file="/installation/_common/homebrew.md" %}}
## Repository packages
@@ -124,20 +124,17 @@ sudo eopkg install hugo
[Solus]: https://getsol.us/
-{{% readfile file="/installation/common/04-docker.md" %}}
-
-{{% readfile file="/installation/common/05-build-from-source.md" %}}
+{{% readfile file="/installation/_common/04-build-from-source.md" %}}
## Comparison
-||Prebuilt binaries|Package managers|Repository packages|Docker|Build from source
-:--|:--:|:--:|:--:|:--:|:--:
-Easy to install?|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:
-Easy to upgrade?|:heavy_check_mark:|:heavy_check_mark:|varies|:heavy_check_mark:|:heavy_check_mark:
-Easy to downgrade?|:heavy_check_mark:|:heavy_check_mark: [^1]|varies|:heavy_check_mark:|:heavy_check_mark:
-Automatic updates?|:x:|varies [^2]|:x:|:x: [^3]|:x:
-Latest version available?|:heavy_check_mark:|:heavy_check_mark:|varies|:heavy_check_mark:|:heavy_check_mark:
+||Prebuilt binaries|Package managers|Repository packages|Build from source
+:--|:--:|:--:|:--:|:--:
+Easy to install?|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:
+Easy to upgrade?|:heavy_check_mark:|:heavy_check_mark:|varies|:heavy_check_mark:
+Easy to downgrade?|:heavy_check_mark:|:heavy_check_mark: [^1]|varies|:heavy_check_mark:
+Automatic updates?|:x:|varies [^2]|:x:|:x:
+Latest version available?|:heavy_check_mark:|:heavy_check_mark:|varies|:heavy_check_mark:
[^1]: Easy if a previous version is still installed.
[^2]: Snap packages are automatically updated. Homebrew requires advanced configuration.
-[^3]: Possible but requires advanced configuration.
diff --git a/docs/content/en/installation/macos.md b/docs/content/en/installation/macos.md
index 9d10642de4e..ccae90b36ba 100644
--- a/docs/content/en/installation/macos.md
+++ b/docs/content/en/installation/macos.md
@@ -9,15 +9,15 @@ menu:
toc: true
weight: 20
---
-{{% readfile file="/installation/common/01-editions.md" %}}
+{{% readfile file="/installation/_common/01-editions.md" %}}
-{{% readfile file="/installation/common/02-prerequisites.md" %}}
+{{% readfile file="/installation/_common/02-prerequisites.md" %}}
-{{% readfile file="/installation/common/03-prebuilt-binaries.md" %}}
+{{% readfile file="/installation/_common/03-prebuilt-binaries.md" %}}
## Package managers
-{{% readfile file="/installation/common/homebrew.md" %}}
+{{% readfile file="/installation/_common/homebrew.md" %}}
### MacPorts
@@ -29,19 +29,17 @@ sudo port install hugo
[MacPorts]: https://www.macports.org/
-{{% readfile file="/installation/common/04-docker.md" %}}
-
-{{% readfile file="/installation/common/05-build-from-source.md" %}}
+{{% readfile file="/installation/_common/04-build-from-source.md" %}}
## Comparison
-||Prebuilt binaries|Package managers|Docker|Build from source
-:--|:--:|:--:|:--:|:--:|:--:
-Easy to install?|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:|
-Easy to upgrade?|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:
-Easy to downgrade?|:heavy_check_mark:|:heavy_check_mark: [^1]|:heavy_check_mark:|:heavy_check_mark:
-Automatic updates?|:x:|:x: [^2]|:x: [^2]|:x:
-Latest version available?|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:
+||Prebuilt binaries|Package managers|Build from source
+:--|:--:|:--:|:--:
+Easy to install?|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:|
+Easy to upgrade?|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:
+Easy to downgrade?|:heavy_check_mark:|:heavy_check_mark: [^1]|:heavy_check_mark:
+Automatic updates?|:x:|:x: [^2]|:x:
+Latest version available?|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:
[^1]: Easy if a previous version is still installed.
[^2]: Possible but requires advanced configuration.
diff --git a/docs/content/en/installation/windows.md b/docs/content/en/installation/windows.md
index 92979d9f250..48c5f7006c2 100644
--- a/docs/content/en/installation/windows.md
+++ b/docs/content/en/installation/windows.md
@@ -9,11 +9,11 @@ menu:
toc: true
weight: 40
---
-{{% readfile file="/installation/common/01-editions.md" %}}
+{{% readfile file="/installation/_common/01-editions.md" %}}
-{{% readfile file="/installation/common/02-prerequisites.md" %}}
+{{% readfile file="/installation/_common/02-prerequisites.md" %}}
-{{% readfile file="/installation/common/03-prebuilt-binaries.md" %}}
+{{% readfile file="/installation/_common/03-prebuilt-binaries.md" %}}
## Package managers
@@ -47,9 +47,7 @@ winget install Hugo.Hugo.Extended
[Winget]: https://learn.microsoft.com/en-us/windows/package-manager/
-{{% readfile file="/installation/common/04-docker.md" %}}
-
-{{% readfile file="/installation/common/05-build-from-source.md" %}}
+{{% readfile file="/installation/_common/04-build-from-source.md" %}}
{{% note %}}
See these [detailed instructions](https://discourse.gohugo.io/t/41370) to install GCC on Windows.
@@ -57,13 +55,13 @@ See these [detailed instructions](https://discourse.gohugo.io/t/41370) to instal
## Comparison
-||Prebuilt binaries|Package managers|Docker|Build from source
-:--|:--:|:--:|:--:|:--:|:--:
-Easy to install?|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:|
-Easy to upgrade?|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:
-Easy to downgrade?|:heavy_check_mark:|:heavy_check_mark: [^2]|:heavy_check_mark:|:heavy_check_mark:
-Automatic updates?|:x:|:x: [^1]|:x: [^1]|:x:
-Latest version available?|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:
+||Prebuilt binaries|Package managers|Build from source
+:--|:--:|:--:|:--:
+Easy to install?|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:|
+Easy to upgrade?|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:
+Easy to downgrade?|:heavy_check_mark:|:heavy_check_mark: [^2]|:heavy_check_mark:
+Automatic updates?|:x:|:x: [^1]|:x:
+Latest version available?|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:
[^1]: Possible but requires advanced configuration.
[^2]: Easy if a previous version is still installed.
diff --git a/docs/content/en/readfiles/README.md b/docs/content/en/readfiles/README.md
deleted file mode 100644
index 4b10f0e4755..00000000000
--- a/docs/content/en/readfiles/README.md
+++ /dev/null
@@ -1,16 +0,0 @@
-# readdirs Directory for Reusable Content
-
-Files in this directory are:
-
-1. Used in *more than one place* within the Hugo docs
-2. Used in Examples of readdir (i.e. in local file templates)
-
-These files are called using the [`readfile` shortcode (source)](../layouts/readfile.html).
-
-You can call this shortcode in the docs as follows:
-
-
-{{% readfile file="/path/to/file.txt" markdown="true" %}}
-
-
-`markdown="true"` is optional (default = `"false"`) and parses the string through the Blackfriday renderer.
diff --git a/docs/content/en/readfiles/dateformatting.md b/docs/content/en/readfiles/dateformatting.md
deleted file mode 100644
index e6c3951517c..00000000000
--- a/docs/content/en/readfiles/dateformatting.md
+++ /dev/null
@@ -1,87 +0,0 @@
-Go templates [format your dates][time] according to a single reference time:
-
-```txt
-Mon Jan 2 15:04:05 MST 2006
-```
-
-You can think of `MST` as `07`, thus making the reference format string a sequence of numbers. The following is [taken directly from the Go docs][gdex]:
-
-```txt
-Jan 2 15:04:05 2006 MST
- 1 2 3 4 5 6 -7
-```
-
-### Hugo date templating reference
-
-Each of the following examples show the reference formatting string followed by the string Hugo will output in your HTML.
-
-Note that the examples were rendered and tested in [CST] and pull from a single example date you might have in your content's front matter:
-
-```yml
-date: 2017-03-03T14:15:59-06:00
-```
-
-`.Date` (i.e. called via [page variable][pagevars])
-: **Returns**: `2017-03-03 14:15:59 -0600 CST`
-
-`"Monday, January 2, 2006"`
-: **Returns**: `Friday, March 3, 2017`
-
-`"Mon Jan 2 2006"`
-: **Returns**: `Fri Mar 3 2017`
-
-`"January 2nd"`
-: **Returns**: `March 3rd`
-
-`"January 2006"`
-: **Returns**: `March 2017`
-
-`"2006-01-02"`
-: **Returns**: `2017-03-03`
-
-`"Monday"`
-: **Returns**: `Friday`
-
-`"02 Jan 06 15:04 MST"` (RFC822)
-: **Returns**: `03 Mar 17 14:15 CST`
-
-`"02 Jan 06 15:04 -0700"` (RFC822Z)
-: **Returns**: `03 Mar 17 14:15 -0600`
-
-`"Mon, 02 Jan 2006 15:04:05 MST"` (RFC1123)
-: **Returns**: `Fri, 03 Mar 2017 14:15:59 CST`
-
-`"Mon, 02 Jan 2006 15:04:05 -0700"` (RFC339)
-: **Returns**: `Fri, 03 Mar 2017 14:15:59 -0600`
-
-### Cardinal numbers and ordinal abbreviations
-
-Spelled-out cardinal numbers (e.g. "one", "two", and "three") and ordinal abbreviations (e.g. "1st", "2nd", and "3rd") are not currently supported.
-
-To continue with the example above:
-
-```go-html-template
-{{ .Date.Format "Jan 2nd 2006" }}
-```
-
-Hugo assumes you want to append `nd` as a string to the day of the month and outputs the following:
-
-```txt
-Mar 2nd 2017
-```
-
-### Use `.Local` and `.UTC`
-
-In conjunction with the [`dateFormat` function][dateFormat], you can also convert your dates to `UTC` or to local timezones:
-
-`{{ dateFormat "02 Jan 06 15:04 MST" .Date.UTC }}`
-: **Returns**: `03 Mar 17 20:15 UTC`
-
-`{{ dateFormat "02 Jan 06 15:04 MST" .Date.Local }}`
-: **Returns**: `03 Mar 17 14:15 CST`
-
-[CST]: https://en.wikipedia.org/wiki/Central_Time_Zone
-[dateFormat]: /functions/dateformat/
-[gdex]: https://golang.org/pkg/time/#example_Time_Format
-[pagevars]: /variables/page/
-[time]: https://golang.org/pkg/time/
diff --git a/docs/content/en/readfiles/index.md b/docs/content/en/readfiles/index.md
deleted file mode 100644
index 3d65eaa0ff9..00000000000
--- a/docs/content/en/readfiles/index.md
+++ /dev/null
@@ -1,3 +0,0 @@
----
-headless: true
----
\ No newline at end of file
diff --git a/docs/content/en/readfiles/sectionvars.md b/docs/content/en/readfiles/sectionvars.md
deleted file mode 100644
index 45aaff1f3f4..00000000000
--- a/docs/content/en/readfiles/sectionvars.md
+++ /dev/null
@@ -1,23 +0,0 @@
-.CurrentSection
-: The page's current section. The value can be the page itself if it is a section or the homepage.
-
-.FirstSection
-: The page's first section below root, e.g. `/docs`, `/blog` etc.
-
-.InSection $anotherPage
-: Whether the given page is in the current section.
-
-.IsAncestor $anotherPage
-: Whether the current page is an ancestor of the given page.
-
-.IsDescendant $anotherPage
-: Whether the current page is a descendant of the given page.
-
-.Parent
-: A section's parent section or a page's section.
-
-.Section
-: The [section](/content-management/sections/) this content belongs to. **Note:** For nested sections, this is the first path element in the directory, for example, `/blog/funny/mypost/ => blog`.
-
-.Sections
-: The [sections](/content-management/sections/) below this content.
diff --git a/docs/content/en/readfiles/testing.txt b/docs/content/en/readfiles/testing.txt
deleted file mode 100644
index 6428710e3cf..00000000000
--- a/docs/content/en/readfiles/testing.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-##### Hello World!
-
-Testing one, **two**, *three*. Don't delete this sample file used in the [templates](/templates/) section of the Hugo docs.
\ No newline at end of file
diff --git a/docs/content/en/showcase/overmindstudios/bio.md b/docs/content/en/showcase/overmindstudios/bio.md
new file mode 100644
index 00000000000..1bd87098442
--- /dev/null
+++ b/docs/content/en/showcase/overmindstudios/bio.md
@@ -0,0 +1,7 @@
+
+**Overmind Studios** is a visual effects studio headquartered in Southern Germany.
+
+The site is built by:
+
+* [Tobias Kummer](https://www.overmind-studios.de/about/)
+
diff --git a/docs/content/en/showcase/overmindstudios/featured.png b/docs/content/en/showcase/overmindstudios/featured.png
new file mode 100644
index 00000000000..c3eaaaf4c53
Binary files /dev/null and b/docs/content/en/showcase/overmindstudios/featured.png differ
diff --git a/docs/content/en/showcase/overmindstudios/index.md b/docs/content/en/showcase/overmindstudios/index.md
new file mode 100644
index 00000000000..3208b2b72c0
--- /dev/null
+++ b/docs/content/en/showcase/overmindstudios/index.md
@@ -0,0 +1,13 @@
+---
+title: Overmind Studios
+description: "A fresh start to make things easier in the future."
+siteURL: https://www.overmind-studios.de/
+byline: "[tobkum](https://github.com/tobkum), Co-Founder Overmind Studios"
+---
+After many years of running our site on WordPress, we decided to switch to Hugo.
+
+WordPress is a great CMS for many people, but it has some downsides, especially for those who need a fast, secure, and customizable site. Plugins can become outdated, customization can be difficult, and bloat can slow down page loading times.
+
+Hugo is a static site generator that addresses many of these problems. It is fast to build and iterate, does not require PHP, is highly customizable, and is easy to learn and use. It is also secure, as it does not have a backend or MySQL database that can be hacked.
+
+We are very happy with our switch to Hugo. It is easy to update our site with new projects, and our Lighthouse score and loading times are both excellent. We now have more time to be creative instead of troubleshooting WordPress quirks and updates.
diff --git a/docs/content/en/templates/data-templates.md b/docs/content/en/templates/data-templates.md
index 0aadbb9ae6e..cf835af4440 100644
--- a/docs/content/en/templates/data-templates.md
+++ b/docs/content/en/templates/data-templates.md
@@ -20,7 +20,7 @@ Hugo supports loading data from YAML, JSON, XML, and TOML files located in the `
## The data folder
-The `data` folder should store additional data for Hugo to use when generating your site.
+The `data` folder should store additional data for Hugo to use when generating your site.
Data files are not for generating standalone pages. They should supplement content files by:
@@ -37,7 +37,7 @@ To access the data using the `site.Data.filename` notation, the file name must b
- `x123.json` - Valid
- `_123.json` - Valid
-To access the data using the [`index`](/functions/index-function/) function, the file name is irrelevant. For example:
+To access the data using the [`index`](/functions/collections/indexfunction) function, the file name is irrelevant. For example:
Data file|Template code
:--|:--
@@ -130,8 +130,7 @@ You can use the following code to render the `Short Description` in your layout:
Short Description of {{ .Site.Data.User0123.Name }}:
{{ index .Site.Data.User0123 "Short Description" | markdownify }}
```
-Note the use of the [`markdownify` template function][markdownify]. This will send the description through the Markdown rendering engine.
-
+Note the use of the [`markdownify`] function. This will send the description through the Markdown rendering engine.
## Get remote data
@@ -255,10 +254,10 @@ If you change any local file and the LiveReload is triggered, Hugo will read the
[config]: /getting-started/configuration/
[csv]: https://tools.ietf.org/html/rfc4180
[customize]: /hugo-modules/theme-components/
-[json]: https://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf "Specification for JSON, JavaScript Object Notation"
+[json]: https://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf
[LiveReload]: /getting-started/usage/#livereload
[lookup]: /templates/lookup-order/
-[markdownify]: /functions/markdownify/
+[`markdownify`]: /functions/transform/markdownify
[OAuth]: https://en.wikipedia.org/wiki/OAuth
[partials]: /templates/partials/
[toml]: https://toml.io/en/latest
diff --git a/docs/content/en/templates/files.md b/docs/content/en/templates/files.md
index 7b058d531a9..2e82688c01f 100644
--- a/docs/content/en/templates/files.md
+++ b/docs/content/en/templates/files.md
@@ -14,11 +14,11 @@ toc: true
## Traverse local files
-With Hugo's [`readDir`][readDir] and [`readFile`][readFile] template functions, you can traverse your website's files on your server.
+With Hugo's [`readDir`] and [`readFile`] template functions, you can traverse your website's files on your server.
## Use `readDir`
-The [`readDir` function][readDir] returns an array of [`os.FileInfo`][osfileinfo]. It takes the file's `path` as a single string argument. This path can be to any directory of your website (i.e., as found on your server's file system).
+The [`readDir`] function returns an array of [`os.FileInfo`] structures. It takes the file's `path` as a single string argument. This path can be to any directory of your website (i.e., as found on your server's file system).
Whether the path is absolute or relative does not matter because---at least for `readDir`---the root of your website (typically `./public/`) in effect becomes both:
@@ -27,7 +27,7 @@ Whether the path is absolute or relative does not matter because---at least for
## Use `readFile`
-The [`readfile` function][readFile] reads a file from disk and converts it into a string to be manipulated by other Hugo functions or added as-is. `readFile` takes the file, including path, as an argument passed to the function.
+The [`readfile`] function reads a file from disk and converts it into a string to be manipulated by other Hugo functions or added as-is. `readFile` takes the file, including path, as an argument passed to the function.
To use the `readFile` function in your templates, make sure the path is relative to your *Hugo project's root directory*:
@@ -48,10 +48,9 @@ If you are going to create [custom shortcodes](/templates/shortcode-templates/)
{{% /note %}}
[called directly in the Hugo docs]: https://github.com/gohugoio/hugoDocs/blob/master/content/en/templates/files.md
-[osfileinfo]: https://golang.org/pkg/os/#FileInfo
-[readDir]: /functions/readdir/
-[readFile]: /functions/readfile/
+[`os.FileInfo`]: https://pkg.go.dev/io/fs#FileInfo
+[`readDir`]: /functions/os/readdir
+[`readFile`]: /functions/os/readfile
[sc]: /content-management/shortcodes/
[sct]: /templates/shortcode-templates/
[readfilesource]: https://github.com/gohugoio/hugoDocs/blob/master/layouts/shortcodes/readfile.html
-[testfile]: https://github.com/gohugoio/hugoDocs/blob/master/content/en/readfiles/testing.txt
diff --git a/docs/content/en/templates/internal.md b/docs/content/en/templates/internal.md
index ee0d7258db0..a73ecde4c88 100644
--- a/docs/content/en/templates/internal.md
+++ b/docs/content/en/templates/internal.md
@@ -32,7 +32,8 @@ Provide your tracking ID in your configuration file:
**Google Analytics 4 (gtag.js)**
{{< code-toggle file="hugo" >}}
-googleAnalytics = "G-MEASUREMENT_ID"
+[services.googleAnalytics]
+ID = "G-MEASUREMENT_ID"
{{ code-toggle >}}
### Use the Google Analytics template
@@ -54,9 +55,16 @@ 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" >}}
-disqusShortname = "your-disqus-shortname"
+[services.disqus]
+shortname = 'your-disqus-shortname'
{{ code-toggle >}}
+Hugo's Disqus template accesses this value with:
+
+```go-html-template
+{{ .Site.Config.Services.Disqus.Shortname }}
+```
+
You can also set the following in the front matter for a given piece of content:
* `disqus_identifier`
@@ -71,8 +79,6 @@ To add Disqus, include the following line in the templates where you want your c
{{ template "_internal/disqus.html" . }}
```
-A `.Site.DisqusShortname` variable is also exposed from the configuration.
-
### Conditional loading of Disqus comments
Users have noticed that enabling Disqus comments when running the Hugo web server on `localhost` (i.e. via `hugo server`) causes the creation of unwanted discussions on the associated Disqus account.
@@ -90,7 +96,7 @@ You can create the following `layouts/partials/disqus.html`:
return;
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
- var disqus_shortname = '{{ .Site.DisqusShortname }}';
+ var disqus_shortname = '{{ .Site.Config.Services.Disqus.Shortname }}';
dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
})();
@@ -159,7 +165,7 @@ To add Open Graph metadata, include the following line between the `` tags
## Twitter Cards
-An internal template for [Twitter Cards](https://developer.twitter.com/en/docs/tweets/optimize-with-cards/overview/abouts-cards),
+An internal template for [Twitter Cards](https://developer.twitter.com/en/docs/twitter-for-websites/cards/overview/abouts-cards),
metadata used to attach rich media to Tweets linking to your site.
### Configure Twitter Cards
@@ -184,11 +190,11 @@ If no images are found at all, then an image-less Twitter `summary` card is used
Hugo uses the page title and description for the card's title and description fields. The page summary is used if no description is given.
-The `.Site.Social.twitter` variable is exposed from the configuration as the value for `twitter:site`.
+Set the value of `twitter:site` in your site configuration:
-{{< code-toggle file="hugo" >}}
-[social]
- twitter = "GoHugoIO"
+{{< code-toggle file="hugo" copy=false >}}
+[params.social]
+twitter = "GoHugoIO"
{{ code-toggle >}}
NOTE: The `@` will be added for you
diff --git a/docs/content/en/templates/introduction.md b/docs/content/en/templates/introduction.md
index 5d60e9ed113..2eb436f8227 100644
--- a/docs/content/en/templates/introduction.md
+++ b/docs/content/en/templates/introduction.md
@@ -114,6 +114,8 @@ all other pages:
Var is {{ $var }}
```
+Variable names must conform to Go's naming rules for [identifiers][identifier].
+
## Functions
Go Templates only ship with a few basic functions but also provide a mechanism for applications to extend the original set.
@@ -301,7 +303,7 @@ Below example is "Example 1" rewritten using `if`:
#### Example 4: `if` .. `else`
Below example is "Example 2" rewritten using `if` .. `else`, and using
-[`isset` function][isset] + `.Params` variable (different from the
+[`isset`] + `.Params` variable (different from the
[`.Param` **function**][param]) instead:
```go-html-template
@@ -355,7 +357,7 @@ The following two examples are functionally the same:
### Example 2: `index`
-The following accesses the page parameter called "disqus_url" and escapes the HTML. This example also uses the [`index` function](/functions/index-function/), which is built into Go Templates:
+The following accesses the page parameter called "disqus_url" and escapes the HTML. This example also uses the [`index`] function, which is built into Go Templates:
```go-html-template
{{ index .Params "disqus_url" | html }}
@@ -569,7 +571,7 @@ params:
sidebarrecentlimit: 5
{{< /code >}}
-Within a footer layout, you might then declare a `