How to fix "Sitemap is not accessible" on Ahrefs in GatsbyJS

Oscar de la Hera Gomez
Two flowers that represent GatsbyJs and Ahref. Beneath them sits the text "Fix Sitemap is not accessible."

Update the gatsby-plugin-robots-txt plugin to reflect the correct sitemap.

A screenshot of Ahref showing the sitemap not accessible error and how it points to the robots.txt file.

The following article aims to resolve the issue that may arise in Ahref if you have not configured the robots.txt file of your GatsbyJS project to point to the correct URL.

For example, in our case, we had assumed that the sitemap.xml value was the same as the example on the gatsby-plugin-robots-txt example when in fact it was not.

A screenshot showing that our robots.txt pointed to the wrong sitemap.xml url.

To resolve this, do the steps below.

Step One: Find the correct Sitemap.xml URL

A screenshot of Chrome showing the sitemap.xml for delasign.com. The screenshot also shows the URL. Find yours and copy the URL.

Determine the correct sitemap.xml URL.

Please note that we used the gatsby-plugin-sitemap to generate our sitemap.

Step Two: Update the Gatsby Config

A screenshot of the gatsby-plugin-robots-txt configuration update which now points to the right sitemap.

In the gatsby-config.js, Update the gatsby-plugin-robots-txt sitemap option to point to the correct URL.

Step Three: Test

A screenshot of Ahref showing that the crawl is now successful.

Build and deploy the Gatsby website and confirm that the sitemap is now accessible and that the crawl is successful.

Looking to learn more about ReactJS, GatsbyJS or SEO ?

Search our blog to find educational content on learning SEO as well as how to use ReactJS and GatsbyJS.

Any Questions?

We are actively looking for feedback on how to improve this resource. Please send us a note to inquiries@delasign.com with any thoughts or feedback you may have.
delasign logo

Book a Free Consultation.

An icon of an email.

Click here to email us.

Fill in the details below to book a free consultation or to let us know about something else. Whatever it is, we are here to help.

How can we help you ?

Contact Details