shithub: hugo

Download patch

ref: be778c31606b08e7320cafb6082700e4240be2fd
parent: be1366074c13a29b5c493cf5641c917f0a00a291
author: bep <[email protected]>
date: Fri May 22 19:43:12 EDT 2015

docs: some more on absURL, relURL

--- a/docs/content/templates/functions.md
+++ b/docs/content/templates/functions.md
@@ -440,8 +440,26 @@
 
 * `{{ "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