Adding relative links to Gatsby Blog markdown

September 10, 2022

Prerequisities

  • A Gatsby Blog, or if you don’t have one you can find out how to create one here.

Approach

I ran into a problem with Google Search console later on, saying that I had redirect errors on my blog. I deduced that the problem had to do with my whole <a> links, so I decided I needed relative paths in this blog.

Let’s first install gatsby-plugin-catch-links with npm install gatsby-plugin-catch-links.

Then add this plugin to your gatsby-config.js:

{
  resolve: `gatsby-plugin-catch-links`
}

And now you can change your links to:

/links-in-gatsby-blog

depending on how your folders are named.

Nothing more, nothing less.


Profile picture

Written by An anonymous coder who lives and works building useful things. Mostly focusing on Django, Vue and overall Python examples.