1

I have the almost same question as this:

But I am confused with the accepted answer, as for my case, the website is hosted using GitHub Pages and has only one html in root directory: index.html

.
├── assets
├── index.html
├── manifest.json
├── robots.txt
├── sitemap.xml

So, What should be my sitemap.xml and canonical url in index.html ?

Should it be like this? sitemap.xml:

<url>
  <loc>https://example.github.io/</loc>
  <lastmod>2021-10-19</lastmod>
  <priority>1.00</priority>
</url>

and in index.html

<link rel="canonical" href="/"/>

I am very new to this and would appreciate a specific answer to this.

For more info:

Currently my sitemap only contains https://example.github.io/ and no canonical url in index.html

Google Search Console url inspection for https://example.github.io/ says:

Coverage [Indexed, not submitted in sitemap]

Sitemaps: N/A

User-declared canonical: None

Google-selected canonical: Inspected URL

2
  • Is your webpage accessible at both https://example.github.io/ and https://example.github.io/index.html? Which URL do you use to access the page through? Which one do you prefer? The canonical URL is your preferred URL.
    – MrWhite
    Oct 20, 2021 at 1:34
  • @MrWhite yes both are accessible. https://example.github.io/ is my preferred URL. This is the actual URL, I am talking about.
    – Rad
    Oct 20, 2021 at 12:08

1 Answer 1

2

The message you're receiving from Google "Indexed, not submitted in sitemap" is typical of any page Google finds through any means other than a sitemap. It's not an error.

If you only have one page, index.html and Google has already found it, you really don't need a sitemap. Sitemaps are not necessary in most cases and Google seems to prefer finding pages via links. A site can have many pages in a sitemap, and GGC will refer to the majority of them via the message you have received. It simply means the pages were found through other means first.

See The Sitemap Paradox

Additional information

Additionally, sitemaps are designed to point to URLs you want indexed (that maybe can't be found via other methods). These can include both the top of your domain, as in example.com, and pages such as example.com/index.html.

In regards to canonicals, a canonical is meant to point the user to another similar or identical page. It's designed to tell search engines the original source for content. However, putting a canonical link on your home page is also considered good practice. You can use something similar to <link rel="canonical" href="https://example.com/"> in your header. Or in your situation, <link rel="canonical" ref="https://example.github.io/">

See also Should homepage be set up as canonical?

4
  • I got you but what would be correct way to write sitemap for this case anyway? Should sitemap include both "example.github.io" and "example.github.io/index.html" or only one of these? And, should there be <link rel="canonical" href="/"/> in index.html?
    – Rad
    Oct 19, 2021 at 22:41
  • @ShihabusSakibRad see modification to answer.
    – Trebor
    Oct 19, 2021 at 23:08
  • Thanks for the clarification. I was confused because example.com and example.com/index.html refers to same page {index.html}, but here it says only to List canonical URLs in sitemaps. And, regarding canonical url, can href be only "/" instead of example.com as both are same, i guess?
    – Rad
    Oct 19, 2021 at 23:26
  • I got the answer of my last question from here. Use absolute paths rather than relative paths with the rel="canonical" link tag
    – Rad
    Oct 19, 2021 at 23:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.