Commit d2cf7aee authored by Pooya Parsa's avatar Pooya Parsa

feat: dynamic canonical link

parent 89854ad0
...@@ -22,10 +22,14 @@ import { feeds } from "~/common/api" ...@@ -22,10 +22,14 @@ import { feeds } from "~/common/api"
export default { export default {
head() { head() {
const host = process.server
? this.$ssrContext.req.headers.host
: window.location.host
return { return {
link: [ link: [
// We use $route.path since we don't use query parameters // We use $route.path since we don't use query parameters
{ rel: "canonical", href: `https://hn.nuxtjs.org${this.$route.path}` } { rel: "canonical", href: `https://${host}${this.$route.path}` }
] ]
} }
}, },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment