Skip to content

Commit

Permalink
fix relative links for multi-instance mode
Browse files Browse the repository at this point in the history
  • Loading branch information
rystaf committed Dec 22, 2023
1 parent 7d6212b commit c874a32
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions routes.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,9 @@ var funcMap = template.FuncMap{
}
body = buf.String()
body = strings.Replace(body, `<img `, `<img loading="lazy" `, -1)
if host != "." {
body = RegReplace(body, `href="/`, `href="./`)
}
body = RegReplace(body, `href="(https:\/\/[a-zA-Z0-9\.\-]+\/(c|u|comment|post)\/[^#\?]*?)"`, `href="/`+host+`/link?url=$1"`)
body = RegReplace(body, `::: ?spoiler (.*?)\n([\S\s]*?):::`, "<details><summary>$1</summary>$2</details>")
return template.HTML(body)
Expand Down

0 comments on commit c874a32

Please sign in to comment.