Bluesky app fork with some witchin' additions 💫
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

feat(seo): add canonical URL filter to remove query parameters

Addresses community feedback about canonical URLs being misleading
when they include UTM parameters. The new Pongo2 filter creates
clean canonical URLs while preserving tracking parameters for
social sharing.

+28
+28
bskyweb/cmd/bskyweb/filters.go
··· 1 + package main 2 + 3 + import ( 4 + "net/url" 5 + 6 + "github.com/flosch/pongo2/v6" 7 + ) 8 + 9 + func init() { 10 + pongo2.RegisterFilter("canonical", filterCanonical) 11 + } 12 + 13 + func filterCanonical(in *pongo2.Value, param *pongo2.Value) (*pongo2.Value, *pongo2.Error) { 14 + urlStr := in.String() 15 + 16 + parsedURL, err := url.Parse(urlStr) 17 + if err != nil { 18 + // If parsing fails, return the original URL 19 + return in, nil 20 + } 21 + 22 + // Remove query parameters and fragment 23 + parsedURL.RawQuery = "" 24 + parsedURL.Fragment = "" 25 + 26 + // Return the cleaned URL 27 + return pongo2.AsValue(parsedURL.String()), nil 28 + }