13 lines
238 B
Go
Raw Permalink Normal View History

2025-03-04 12:16:16 +01:00
package middleware
import (
"fmt"
"git.urbach.dev/go/web"
)
func Canonical(ctx web.Context) error {
ctx.Response().SetHeader("Link", fmt.Sprintf(`<https://urbach.dev%s>; rel="canonical"`, ctx.Request().Path()))
return ctx.Next()
}