commit f09505a657c36d722c19f925731a1d37bed9eaf6
parent 6410965b97f1a9a642c62bcbaf99fa745411e786
Author: spf13 <steve.francia@gmail.com>
Date: Tue, 10 Dec 2013 19:36:44 -0500
Adding example short codes to the documentation
Diffstat:
1 file changed, 28 insertions(+), 0 deletions(-)
diff --git a/docs/content/extras/shortcodes.md b/docs/content/extras/shortcodes.md
@@ -33,6 +33,13 @@ The format for named parameters models that of html with the format name="value"
{{ % youtube 09jf3ow9jfw %}}
+Would load the template /layouts/shortcodes/youtube.html
+
+ <div class="embed video-player">
+ <iframe class="youtube-player" type="text/html" width="640" height="385" src="http://www.youtube.com/embed/{{ index .Params 0 }}" allowfullscreen frameborder="0">
+ </iframe>
+ </div>
+
This would be rendered as
<div class="embed video-player">
@@ -48,6 +55,27 @@ This would be rendered as
{{ % img src="/media/spf13.jpg" title="Steve Francia" %}}
+Would load the template /layouts/shortcodes/img.html
+
+ <!-- image -->
+ <figure {{ if isset .Params "class" }}class="{{ index .Params "class" }}"{{ end }}>
+ {{ if isset .Params "link"}}<a href="{{ index .Params "link"}}">{{ end }}
+ <img src="{{ index .Params "src" }}" {{ if or (isset .Params "alt") (isset .Params "caption") }}alt="{{ if isset .Params "alt"}}{{ index .Params "alt"}}{{else}}{{ index .Params "caption" }}{{ end }}"{{ end }} />
+ {{ if isset .Params "link"}}</a>{{ end }}
+ {{ if or (or (isset .Params "title") (isset .Params "caption")) (isset .Params "attr")}}
+ <figcaption>{{ if isset .Params "title" }}
+ <h4>{{ index .Params "title" }}</h4>{{ end }}
+ {{ if or (isset .Params "caption") (isset .Params "attr")}}<p>
+ {{ index .Params "caption" }}
+ {{ if isset .Params "attrlink"}}<a href="{{ index .Params "attrlink"}}"> {{ end }}
+ {{ index .Params "attr" }}
+ {{ if isset .Params "attrlink"}}</a> {{ end }}
+ </p> {{ end }}
+ </figcaption>
+ {{ end }}
+ </figure>
+ <!-- image -->
+
Would be rendered as:
<figure >