diff options
author | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2017-05-06 20:15:28 +0200 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2017-05-13 22:44:15 +0300 |
commit | af72db806f2c1c0bf1dfe5832275c41eeba89906 (patch) | |
tree | a1bc9c7d09836073a811a1b395b7756727fdb210 /hugolib/site_output_test.go | |
parent | e951d65771ca299aa899e91bfe00411a5ada8f19 (diff) |
hugolib: Handle shortcode per output format
This commit allows shortcode per output format, a typical use case would be the special AMP media tags.
Note that this will only re-render the "overridden" shortcodes and only in pages where these are used, so performance in the normal case should not suffer.
Closes #3220
Diffstat (limited to 'hugolib/site_output_test.go')
-rw-r--r-- | hugolib/site_output_test.go | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/hugolib/site_output_test.go b/hugolib/site_output_test.go index ef2cdf9ad..2935f3257 100644 --- a/hugolib/site_output_test.go +++ b/hugolib/site_output_test.go @@ -99,6 +99,8 @@ title: "%s" outputs: %s --- # Doc + +{{< myShort >}} ` mf := afero.NewMemMapFs() @@ -118,6 +120,8 @@ other = "Olboge" "layouts/partials/GoHugo.html", `Go Hugo Partial`, "layouts/_default/baseof.json", `START JSON:{{block "main" .}}default content{{ end }}:END JSON`, "layouts/_default/baseof.html", `START HTML:{{block "main" .}}default content{{ end }}:END HTML`, + "layouts/shortcodes/myShort.html", `ShortHTML`, + "layouts/shortcodes/myShort.json", `ShortJSON`, "layouts/_default/list.json", `{{ define "main" }} List JSON|{{ .Title }}|{{ .Content }}|Alt formats: {{ len .AlternativeOutputFormats -}}| @@ -141,6 +145,7 @@ List HTML|{{.Title }}| {{ .Site.Language.Lang }}: {{ T "elbow" -}} Partial Hugo 1: {{ partial "GoHugo.html" . }} Partial Hugo 2: {{ partial "GoHugo" . -}} +Content: {{ .Content }} {{ end }} `, ) @@ -180,6 +185,7 @@ Partial Hugo 2: {{ partial "GoHugo" . -}} "Output/Rel: JSON/alternate|", "Output/Rel: HTML/canonical|", "en: Elbow", + "ShortJSON", ) th.assertFileContent("public/index.html", @@ -187,6 +193,7 @@ Partial Hugo 2: {{ partial "GoHugo" . -}} // parsed with html/template. `List HTML|JSON Home|<atom:link href=http://example.com/blog/ rel="self" type="text/html+html" />`, "en: Elbow", + "ShortHTML", ) th.assertFileContent("public/nn/index.html", "List HTML|JSON Nynorsk Heim|", @@ -196,10 +203,12 @@ Partial Hugo 2: {{ partial "GoHugo" . -}} "Output/Rel: JSON/canonical|", // JSON is plain text, so no need to safeHTML this and that `<atom:link href=http://example.com/blog/index.json rel="self" type="application/json+json" />`, + "ShortJSON", ) th.assertFileContent("public/nn/index.json", "List JSON|JSON Nynorsk Heim|", "nn: Olboge", + "ShortJSON", ) } |