Strip query parameters from URL
Anirudh Oppiliappan x@icyphox.sh
Fri, 17 Sep 2021 18:03:38 +0530
1 files changed,
8 insertions(+),
1 deletions(-)
jump to
M
mail/template.go
→
mail/template.go
@@ -3,10 +3,17 @@
import ( "bytes" "html/template" + "net/url" "path/filepath" "git.icyphox.sh/forlater/navani/reader" ) + +func stripQueryParams(u *url.URL) string { + u.RawQuery = "" + u.Fragment = "" + return u.String() +} func RenderTemplate(file string, article *reader.Article) ([]byte, error) { t, err := template.ParseGlob(filepath.Join("templates", "*.tpl"))@@ -24,7 +31,7 @@ }{
template.HTML(article.Content), article.Title, article.Byline, - article.URL.String(), + stripQueryParams(article.URL), }); err != nil { return nil, err }