DEV Community

loading...

[AskDev] GatsbyJS and SEO: how to manage internal routing?

bellons91 profile image Davide Bellone ・1 min read

With GatsbyJS you can handle navigation using relative paths.

For example, if I have 2 pages under the articles path:

www.myblog.com/articles/firstArticle
www.myblog.com/articles/secondArticle

and I want to insert a link in the secondArticle that points to the firstArticle, I can do this:

Hello, I'm the second article, and here you can find the
[first article](./firstArticle)
Enter fullscreen mode Exit fullscreen mode

This works well in the site, since Gatsby takes care of the navigation between pages.

But the HTML that Gatsby generates is (more or less) this one:

Hello, I'm the second article, and here you can find the
<a href="./firstArticle">first article</a>
Enter fullscreen mode Exit fullscreen mode

So, my question is: do crawlers understand that the linked page is

www.myblog.com/articles/firstArticle
and not
www.myblog.com/articles/secondArticle/firstArticle

?

So, how do you link pages between the same blog? Absolute URL, relative path or something else?

Discussion (0)

pic
Editor guide