Reputation: 2446
Will this code correctly instruct Google to index my sitemap (or make it aware it exists)?
<link rel="sitemap" href="./sitemap.txt" type="text/plain" title="Sitemap" />
Google states in their instructions that plain text files simply listing URLs are permitted as sitemap format, but I could not find any verified solution as to how to link to this kind of file in the HTML <head>
.
I modified the solution in this answer by changing the type
attribute. Is this an accepted way to link to a plain text sitemap file?
I realize I can submit the file to Google directly, eg.
https://www.google.com/ping?sitemap=FULL_URL_OF_SITEMAP
(Source)
But I'd like to include it in markup so other search engines (and whoever wants it) can possibly find it too.
Upvotes: 1
Views: 558
Reputation: 11
To answer your question: HTML5 defines the values that you are allowed to use in rel
and sitemap
is not recognised by the validator. So the short answer is: It wouldn't work. See also here: WIKI, which statements are allowed.
Basically the best way to let other search engines know, that you have a sitemap, is to add the sitemap to your robots.txt file.
Therefore create a robots.txt file in your webservers root directory, so it looks like this: example.com/robots.txt
Then add the following to the file:
Sitemap: http://www.example.com/sitemap.txt
User-agent: *
Disallow:
The contents of the file tell search engines what pages to crawl (and what pages not to crawl) and also which search engines have permission to crawl your site. It is important that you have this file because when a search engine bot enters your site, it will look for your robots.txt before doing anything else.
To clarify the commands:
User-agent: Defines, which search engines are allowed to use the robots.txt file. However "bad" engines will still use the file, even if you say no. The * defines, that all engines are allowed to crawl the file.
Disallow: With this statement you can define, which directorys of your website should not be crawled by the search engines e.g. /photos/
Hope I could help!
Upvotes: 1