hugo

Unnamed repository; edit this file 'description' to name the repository.

git clone git://git.shimmy1996.com/hugo.git
commit 7d31d5f59d9621efcbd3229c8e5fef69fbdb4589
parent e03f27ccf852a07b868bd87824129b41c2b42ebc
Author: digitalcraftsman <digitalcraftsman@users.noreply.github.com>
Date:   Fri, 20 Nov 2015 19:44:05 +0100

Add shortcode for tweets

Diffstat:
Mtpl/template_embedded.go | 3+++
1 file changed, 3 insertions(+), 0 deletions(-)
diff --git a/tpl/template_embedded.go b/tpl/template_embedded.go
@@ -47,6 +47,9 @@ func (t *GoHTMLTemplate) EmbedShortcodes() {
   <iframe src="//player.vimeo.com/video/{{ index .Params 0 }}" style="position: absolute; top: 0; left: 0; width: 100%; height: 100%;" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>
 </div>`)
 	t.AddInternalShortcode("gist.html", `<script src="https://gist.github.com/{{ index .Params 0 }}/{{ index .Params 1 }}.js"></script>`)
+	t.AddInternalShortcode("tweet.html", `{{ $user  := index .Params 0 }}
+{{ $tweet := index .Params 1 }}
+{{ (getJSON "https://api.twitter.com/1/statuses/oembed.json?url=https://twitter.com/" $user "/status/" $tweet).html | safeHTML }}`)
 }
 
 func (t *GoHTMLTemplate) EmbedTemplates() {