summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--docs/content/templates/functions.md20
1 files changed, 19 insertions, 1 deletions
diff --git a/docs/content/templates/functions.md b/docs/content/templates/functions.md
index 6c267f0f5..c949fa987 100644
--- a/docs/content/templates/functions.md
+++ b/docs/content/templates/functions.md
@@ -440,8 +440,26 @@ Both `absURL` and `relURL` considers the configured value of `baseURL`, so given
* `{{ "mystyle.css" | absURL }}` → "http://mysite.com/hugo/mystyle.css"
* `{{ "mystyle.css" | relURL }}` → "/hugo/mystyle.css"
+* `{{ "http://gohugo.io/" | relURL }}` → "http://gohugo.io/"
+* `{{ "http://gohugo.io/" | absURL }}` → "http://gohugo.io/"
-**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.
+The last two examples may look funky, but is useful if you, say, have a list of images, some of them hosted externally, some locally:
+
+```
+<script type="application/ld+json">
+{
+ "@context" : "http://schema.org",
+ "@type" : "BlogPosting",
+ "image" : {{ apply .Params.images "absURL" "." }}
+}
+</script>
+```
+
+The above also exploits the fact that the Go template parser JSON-encodes objects inside `script` tags.
+
+
+
+**Note:** These functions are smart about missing slashes, but will not add one to the end if not present.
### ref, relref