tpl: Alias tweet shortode to twitter

See #4765
This commit is contained in:
Bjørn Erik Pedersen
2018-05-24 11:24:38 +02:00
parent 6aa2c38507
commit 3bfe8f4be6
5 changed files with 19 additions and 8 deletions

View File

@@ -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)
}
}
}
}