: How do I correctly add index page to xml sitemap - do I need a canonical expression? When I create an xml sitemap using an online sitemap creator, it adds the following <url> <loc>http://www.mysite.co.uk/&l
When I create an xml sitemap using an online sitemap creator, it adds the following
<url>
<loc>http://www.mysite.co.uk/</loc>
<lastmod>2017-09-26T18:03:59+00:00</lastmod>
<changefreq>monthly</changefreq>
<priority>1.0000</priority>
</url>
<url>
<loc>http://www.mysite.co.uk/index.html</loc>
<lastmod>2017-09-26T18:03:59+00:00</lastmod>
<changefreq>monthly</changefreq>
<priority>0.8000</priority>
</url>
This seems to add the same page twice, as the index.html is the same page as the domain name.
I don't want Google to class this as duplicate content
Do I need to add a canonical expression to my index.html page - like this?
<link rel="canonical" href="http://www.mysite.co.uk/ >
If I do that, do I remove this line from the sitemap?
<url>
<loc>http://www.mysite.co.uk/index.html</loc>
<lastmod>2017-09-26T18:03:59+00:00</lastmod>
<changefreq>monthly</changefreq>
<priority>0.8000</priority>
</url>
The links to my homepage on all my other pages look like this
<a href="/index.html">Home</a>
Do I need to change these links so they read
<a href="http://www.mysite.co.uk">Home</a>
Any help would be appreciated
Thanks in advance
More posts by @Looi9037786
2 Comments
Sorted by latest first Latest Oldest Best
You need to fix this issue by “homogenizing” the way the internal links are set across the whole website. When you create internal links you have basically two options 1) use relative or 2) absolute paths.
For example, the same internal link could be set either way like this:
href=“/index.html“ (1)
href=“http://www.example.com/“ (2)
You need to decide if you are going to use relative or absolute paths. Pick one way and stick with it. Make sure you are consistent across the website.
Your sitemap however, should alway contain the website URLs using absolute paths. In your case, I would definitely create one and only one reference to the homepage, even if you have created links using relative paths to the file (/index.html), you need to use absolute paths here.
To avoid having this issue make sure you do the following:
decide between relative vs absolute paths.
if you choose relative make sure all your internal links that point to the homepage via navigation menu, logos or any other internal links are using href=“/“ instead of href=“/index.html”.
fix this canonical issue by creating 301 redirects from example.com/index.html to example.com. One way to do this is via the .htaccess file if you are using Apache as the web server.
Note: the online sitemap creator that you used is an automated tool or web crawler that will retrieve the urls found according to the way the web server is configured, if the crawler or bot is smart he will classify /index.html the same as example.com. My recommendation here is always double check the output online tools and in this case, feel free to edit the sitemap according to what I said above.
XML Sitemaps are still very important to Google.
I manage a site with 100m+ pages and can tell you from experience that they make a strong, positive, impact, on increasing our crawl rate (as seen in Google Search Console).
Answer: Keep your URLs clean throughout your codebase.
For your internal links, canonicals, and XML Sitemaps:
Do not include .html
When linking to your homepage use <a href="/" title="home">
BE CONSISTENT with your trailing slashes. (example.com/about is different than example.com/about/) Choose one pattern and stick to it.
Try going to your home page via all combinations to see if the page loads.
If you go to example.com, example.com/ and example.com/index.html they should all properly 301 redirect to your preferred canonical version of the URL.
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.