ref: be8235557032ddeba024deb70dcfb60fda03aed1
parent: be4f48652da9177e01e7dd046146d597c99d4b54
author: bep <[email protected]>
date: Mon May 11 15:08:52 EDT 2015
Add doc for absURL and relURL Also group URL related functions in doc.
--- a/docs/content/templates/functions.md
+++ b/docs/content/templates/functions.md
@@ -309,12 +309,6 @@
e.g. `{{ .Title | markdownify }}`
-### ref, relref
-Looks up a content page by relative path or logical name to return the permalink (`ref`) or relative permalink (`relref`). Requires a Node or Page object (usually satisfied with `.`). Used in the [`ref` and `relref` shortcodes]({{% ref "extras/crossreferences.md" %}}).
-
-e.g. {{ ref . "about.md" }}
-
-
### replace
Replace all occurences of the search string with the replacement string.
@@ -377,7 +371,43 @@
Note: "ZgotmplZ" is a special value that indicates that unsafe content reached a
CSS or URL context.
+### title
+Convert all characters in string to titlecase.
+e.g. `{{title "BatMan"}}` → "Batman"
+
+
+### trim
+Trim returns a slice of the string with all leading and trailing characters contained in cutset removed.
+
+e.g. `{{ trim "++Batman--" "+-" }}` → "Batman"
+
+
+### upper
+Convert all characters in string to uppercase.
+
+e.g. `{{upper "BatMan"}}` → "BATMAN"
+
+
+
+
+## Urls
+
+### absURL, relURL
+
+Both `absURL` and `relURL` considers the configured value of `baseURL`, so given a `baseURL` set to `http://mysite.com/hugo/`:
+
+* `{{ "mystyle.css" | absURL }}` → "http://mysite.com/hugo/mystyle.css"
+* `{{ "mystyle.css" | relURL }}` → "/hugo/mystyle.css"
+
+**Note:** If `canonifyUrls` is enabled, the last example above will be "/mystyle.css". These functions are smart about missing slashes, but will not add one to the end if not present.
+
+
+### ref, relref
+Looks up a content page by relative path or logical name to return the permalink (`ref`) or relative permalink (`relref`). Requires a Node or Page object (usually satisfied with `.`). Used in the [`ref` and `relref` shortcodes]({{% ref "extras/crossreferences.md" %}}).
+
+e.g. {{ ref . "about.md" }}
+
### safeURL
Declares the provided string as a "safe" URL or URL substring (see [RFC 3986][]).
A URL like `javascript:checkThatFormNotEditedBeforeLeavingPage()` from a trusted
@@ -415,24 +445,6 @@
With this change, we finally get `<li><a href="irc://irc.freenode.net/#golang">IRC: #golang at freenode</a></li>`
as intended.
-
-
-### title
-Convert all characters in string to titlecase.
-
-e.g. `{{title "BatMan"}}` → "Batman"
-
-
-### trim
-Trim returns a slice of the string with all leading and trailing characters contained in cutset removed.
-
-e.g. `{{ trim "++Batman--" "+-" }}` → "Batman"
-
-
-### upper
-Convert all characters in string to uppercase.
-
-e.g. `{{upper "BatMan"}}` → "BATMAN"
### urlize