aboutsummaryrefslogtreecommitdiff
path: root/route/util.go
diff options
context:
space:
mode:
Diffstat (limited to 'route/util.go')
-rw-r--r--route/util.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/route/util.go b/route/util.go
index 838961e..9a2de75 100644
--- a/route/util.go
+++ b/route/util.go
@@ -373,4 +373,17 @@ func TemplateFunctions(engine *html.Engine) {
return returnString
})
+
+ engine.AddFunc("parseLink", func(board activitypub.Actor, link string) string {
+ var obj = activitypub.ObjectBase{
+ Id: link,
+ }
+
+ var OP string
+ if OP, _ = obj.GetOP(); OP == obj.Id {
+ return board.Name + "/" + util.ShortURL(board.Outbox, obj.Id)
+ }
+
+ return board.Name + "/" + util.ShortURL(board.Outbox, OP) + "#" + util.ShortURL(board.Outbox, link)
+ })
}