Sitemap and SEO

July 28, 2020

SEO and adding title and description to the header came preinstalled with the starter gatsby-starter-blog-mdx. I added keywords to each blog post and plugged that into the Helmet component in the SEO.

My initial scores for SEO were 89 because of a ‘Learn More’ link on the nav-bar, which is considered too general a link and not informative enough.Renaming it to ‘How It Works’ bumped up the SEO scores from 89 to 100.

A sitemap is a further way to enhance the Search Engine Optimization on your site. Here’s an article about how adding a Sitemap increased organic search by 235% and organic traffic by 120% in a span of 6 months.

A sitemap is an XML file with details about all the links on your website. Google’s crawlers read this file and index your site. Here are options to make your sitemap available to Google. I chose to go with the robots.txt file option.

To generate a sitemap I did the following:

  1. installed gatsby-plugin-advanced-sitemap

  2. updated siteMetadata->siteUrl in gatsby-config.js to:

    module.exports = {
    siteMetadata: {
    siteUrl: `https://gatsby-replication-tufandotio.netlify.app/`,
    },
    }
  3. This starter came with a /static/robots.txt with the following content:

    User-agent: *
    Disallow:

    I updated it by adding the line:

    Sitemap: https://gatsby-replication-tufandotio.netlify.app/sitemap.xml
  4. Note that you can see the sitemap only on a production build at the above Sitemap URL.

I also tried the alternate ping verification method. I used the “ping” functionality to ask Google to crawl my sitemap:

  1. http://google.com/ping?sitemap=https://my-website-URL/sitemap.xml

  2. It took me to the Google Search Console.

  3. Under URL prefix, I added the url https://my-website-URL.

  4. It gave me a html file to download to the site for verification. I downloaded it and checked it into static/*.html.

  5. Google says to submit this Sitemap using the “ping” method every time it changes. This sounds a bit cumbersome. Maybe robots.txt is a better way to do this.


tufan.io
Making it simple to create, manage & secure cloud applications.