13 lines
238 B
Go
13 lines
238 B
Go
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()
|
|
}
|