summaryrefslogtreecommitdiff
path: root/internal/router/template.go
diff options
context:
space:
mode:
authorLibravatar f0x52 <f0x@cthu.lu>2022-09-07 16:53:12 +0200
committerLibravatar GitHub <noreply@github.com>2022-09-07 16:53:12 +0200
commitd09ddb4769b503cd59edfc97353af1fd16e4c2ad (patch)
tree4f61c5fb5e4696dc2141d682e7986e6d04aa6e72 /internal/router/template.go
parent[feature] Custom emoji updates (serve emoji via s2s api, tune db models) (#805) (diff)
downloadgotosocial-d09ddb4769b503cd59edfc97353af1fd16e4c2ad.tar.xz
[feature] opengraph meta tags (#806)
* f0x gitignore additions * better meta title and descriptions * user avatar icon for thread and profile meta tags * use proper tag for image * whitespace * add noescapeAttr template function * use ogMeta struct for opengraph * maxOGDescriptionLength = 300 Co-authored-by: tsmethurst <tobi.smethurst@protonmail.com>
Diffstat (limited to 'internal/router/template.go')
-rw-r--r--internal/router/template.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/internal/router/template.go b/internal/router/template.go
index a9d5726ea..2d6026a2e 100644
--- a/internal/router/template.go
+++ b/internal/router/template.go
@@ -70,6 +70,11 @@ func noescape(str string) template.HTML {
return template.HTML(str)
}
+func noescapeAttr(str string) template.HTMLAttr {
+ /* #nosec G203 */
+ return template.HTMLAttr(str)
+}
+
func timestamp(stamp string) string {
t, _ := time.Parse(time.RFC3339, stamp)
return t.Format("January 2, 2006, 15:04:05")
@@ -151,6 +156,7 @@ func LoadTemplateFunctions(engine *gin.Engine) {
engine.SetFuncMap(template.FuncMap{
"escape": escape,
"noescape": noescape,
+ "noescapeAttr": noescapeAttr,
"oddOrEven": oddOrEven,
"visibilityIcon": visibilityIcon,
"timestamp": timestamp,