site  news  contact

Submitting a sitemap to Google

September 10, 2017 — BarryK

For a shellCMS managed site, this has turned out to be easy-peasy.

A sitemap is a file, named sitemap.xml, at the root of your site, that helps the Google site-indexing-bot to discover everything on your site. It also works for some other search engines.

There are many tools to create this file, and this is a good links page to most of them:

https://code.google.com/archive/p/sitemap-generators/wikis/SitemapGenerators.wiki

Some of them cost money. But, right at the bottom of the page, I found this:

http://www.bin-co.com/php/programs/tools/sitemap_generator/

As shown on that site, just edit these three variables:

$url "http://www.bin-co.com/"//The Url of the site - the last '/' is needed

$root_dir '../..'//Where the root of the site is with relation to this file.

$file_mask '*.php'//Or *.html or whatever - Any pattern that can be used in the glob() php function can be used here.

It is a good idea to hide create_sitemap.php in a folder somewhere on your site, to prevent every Tom, Dick and Harry from running it! if the name of the script is changed, there is one place in the script that will also have to be changed.

I changed $file_mask to "*.html", as my site is purely static.

For my host, omnis.com, php scripts do not need any execute bits set in the php file, so it is just "644". I pointed my browser at the script, and the sitemap, bkhome.org/sitemap.xml, got generated, just about instantly.

Submitting to Google

You need to login to Google Webmaster Tools:

https://www.google.com/webmasters/tools

You need to register your website with Google, and Google will generate a file that you have to upload, to verify that you own the site.

After verification, you can submit your sitemap.

There are tutorial pages on how to do this. For example:

https://blog.kissmetrics.com/beginners-guide-to-google-webmaster-tools/

I decided that I might as well regenerate sitemap.xml everytime that I run remote-sync, so appended this line:

defaultbrowser http://bkhome.org/path-to/create_sitemap.php &

Bing can also read a sitemap.

Submitting to Bing

Read instructions here:

https://www.bing.com/webmaster/help/how-to-submit-sitemaps-82a15bd4

You can join Bing Webmaster Tools, however there is one way of submitting the sitemap without having to join. As explained in the above link, point your browser at:

http://www.bing.com/ping?sitemap=http%3A%2F%2Fwww.example.com/sitemap.xml

Of course, substitute your domain name. I tested this, it works, but you still would need to join Bing Webmaster Tools to get feedback on the submission.

This can also be put into the remote-sync script, to bring up that URI in your browser.

Ping Google too

Yes, this method of pinging can also be used for Google:

http://www.google.com/webmasters/sitemaps/ping?sitemap=http://example.com/sitemap.xml

This is a good site that explains it, for all the search engines:

https://superdevresources.com/ping-sitemap/

There is another way...

robots.txt

Another way to submit your sitemap to the search engines, is to create a file robots.txt at the root of the site. Put this into it:

Sitemap: http://my-domain.com/sitemap.xml

But, you will have to wait until the search engine next visits your site.

Submitting to DuckDuckGo

You can't. DuckDuckGo gets it's information from Bing and Google, especially Bing. So, submit to Bing, and it will (eventually) end up at DuckDuckGo.

Tags: shellcms