How to replace relative to absolute urls in canonical tag using seo-tag in Jekyll

I’ve installed seo-tag and it works good. The only thing that I’d like to fix is to change automatically generated reletive paths in canonicals to the absoule one. As it seems Google recommends to use absolute paths. How can I do it?

For now the link looks like: <link rel="canonical" href="/page" />
I want it to look like: <link rel="canonical" href="https//" />

Certainly I can specify canonicals for each page manuall, but I want this to be done automatically. Is there any option? Thaks!

1 Like

Your samples are missing. Not enough forum points to post links?

The docs say that the tag will use the domain URL by default

So make sure it is set e.g.

baseurl: /my-repo/

And build in production mode. GitHub Pages does this for you but for local builds and other systems like Netlify you must set this yourself.

When doing serve or build:

JEKYLL_ENV=production bundle exec jekyll build --trace

I like trace by the way for verbose errors.

1 Like