summaryrefslogtreecommitdiffstats
path: root/tpl
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2018-05-24 11:24:38 +0200
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2018-05-24 11:40:47 +0200
commit3bfe8f4be653f44674293685cb5750d90668b2f6 (patch)
tree19f2c4eae1c4d4052199034db1dcfbe4ddf03806 /tpl
parent6aa2c38507aa1c2246222684717b4d69d26b03d7 (diff)
tpl: Alias tweet shortode to twitter
See #4765
Diffstat (limited to 'tpl')
-rw-r--r--tpl/tplimpl/embedded/templates.autogen.go2
-rwxr-xr-xtpl/tplimpl/embedded/templates/shortcodes/twitter.html (renamed from tpl/tplimpl/embedded/templates/shortcodes/tweet.html)2
-rw-r--r--tpl/tplimpl/template.go13
3 files changed, 14 insertions, 3 deletions
diff --git a/tpl/tplimpl/embedded/templates.autogen.go b/tpl/tplimpl/embedded/templates.autogen.go
index ebed43a37..94e4c33ab 100644
--- a/tpl/tplimpl/embedded/templates.autogen.go
+++ b/tpl/tplimpl/embedded/templates.autogen.go
@@ -363,7 +363,7 @@ M66.52,7.74c-0.78-2.93-2.49-5.41-5.42-6.19C55.79,.13,34,0,34,0S12.21,.13,6.9,1.5
{{- if not $pc.Disable -}}
<script async class='speakerdeck-embed' data-id='{{ index .Params 0 }}' data-ratio='1.33333333333333' src='//speakerdeck.com/assets/embed.js'></script>
{{- end -}}`},
- {`shortcodes/tweet.html`, `{{- $pc := .Page.Site.Config.Privacy.Tweet -}}
+ {`shortcodes/twitter.html`, `{{- $pc := .Page.Site.Config.Privacy.Twitter -}}
{{- if not $pc.Disable -}}
{{ (getJSON "https://api.twitter.com/1/statuses/oembed.json?id=" (index .Params 0)).html | safeHTML }}
{{- end -}}`},
diff --git a/tpl/tplimpl/embedded/templates/shortcodes/tweet.html b/tpl/tplimpl/embedded/templates/shortcodes/twitter.html
index 09adaf7e9..d9bef725f 100755
--- a/tpl/tplimpl/embedded/templates/shortcodes/tweet.html
+++ b/tpl/tplimpl/embedded/templates/shortcodes/twitter.html
@@ -1,4 +1,4 @@
-{{- $pc := .Page.Site.Config.Privacy.Tweet -}}
+{{- $pc := .Page.Site.Config.Privacy.Twitter -}}
{{- if not $pc.Disable -}}
{{ (getJSON "https://api.twitter.com/1/statuses/oembed.json?id=" (index .Params 0)).html | safeHTML }}
{{- end -}} \ No newline at end of file
diff --git a/tpl/tplimpl/template.go b/tpl/tplimpl/template.go
index 7c7d639f0..74860b67e 100644
--- a/tpl/tplimpl/template.go
+++ b/tpl/tplimpl/template.go
@@ -686,10 +686,21 @@ func (t *templateHandler) addTemplateFile(name, baseTemplatePath, path string) e
}
}
+var embeddedTemplatesAliases = map[string][]string{
+ "shortcodes/twitter.html": []string{"shortcodes/tweet.html"},
+}
+
func (t *templateHandler) loadEmbedded() {
for _, kv := range embedded.EmbeddedTemplates {
// TODO(bep) error handling
- t.addInternalTemplate(kv[0], kv[1])
+ name, templ := kv[0], kv[1]
+ t.addInternalTemplate(name, templ)
+ if aliases, found := embeddedTemplatesAliases[name]; found {
+ for _, alias := range aliases {
+ t.addInternalTemplate(alias, templ)
+ }
+
+ }
}
}