I am sure you would not like to keep talking when no one is listening, neither me. So if you blog or put something on the web you definitely want it to appear in search and let people reach it easily.
I migrated to Ghost blogging platform recently and kind of having great experience. But still long way to go Ghost.
At the time of this writing, Ghost does not provide any out-of-the-box way to generate sitemap for your ghost blog, thank god they atleast give RSS.
Now we all know that it would take years for search engine bots to find all your pages and index them. Submitting sitemaps to webmaster tools is the quick way to make it easy for search bots to index your page.
So I started finding ways to make it possible creating sitemap for my ghost blog.
Option 1: [Generate sitemap using SHELL script - Blog post from Centminmod (Blog post URL not found anymore]. I came along this first and tried to get my head around on how can i make it possible for my type of Ghost hosting. Not to blame the author for creating it but I sincerely could not figure out how to make it work, may be because I am too alien to SHELL scripting at this point. 30 minutes of playing with it and I had to standup and take a walk.
Option 2: Generate sitemap using MySQL with Ruby. This was interesting to me as I got in touch with some bit of Ruby (when I was playing with Github pages). It is basically Ruby script that will ready your Ghost blog database and generate sitemap XML based on that. In few minutes I figured out that this will in no ways work for my initial Ghost setup (I used SQLite3) and will require MySQL, because I am not an Ruby expert and also fiddling with SQLite3 for the first time. After few hours of still trying to make it work with SQLite3, I decided to find other options.
Option 3: Generate sitemap online. I typed in my blog's URL and baaaaaam sitemap is ready (with sitemap.tar.gz, sitemap.html and URLList.txt, pretty cool). I uploaded this to my Ghost hosting and submitted to Google. It indexed / discovered all my possible pages and Google webmaster tool was pretty happy about it. Currently I am at 314 URL count in sitemap. This online generator will generate sitemap for 500 URLs only. So basically either I have to again find another option or pay some subscription money to this guys.
I am pretty firm that I will not spend money for the blog expect hosting, this was one of the major reason why I shifted to Ghost (and also because of its beautiful post editor). So I decided to disect Option 2 script and make it generate sitemap similar to Option 3 result sitemap.
This was my first time hacking on Ruby and I totally enjoyed it. I used Sublime Text editor (a "shut-up and take my money" text editor) and started modifying the original script provided by in Option 2. Thanks Marco for the efforts, appreciate it.
So the new / modified version of this ruby script will generate sitemap including:
- Index page and trailing pagination pages (available in original).
- Article pages and static pages (available in original).
- RSS page of your ghost blog (new offering).
- Tag pages and trailing pagination of tag pages (new offering).
Also added few validation for totally non-ruby, non-linux people and re-vamped the verbose logging to make sure it serves the purpose better.
Original script creates
sitemap.xml, but I recommend and prefer to use
sitemap.tar.gz to save transfer bytes. This new script is using sitemap_generator gem for all boilerplate sitemap generation part. I call this new script - Needy ghost sitemap generator :) [Because I needed it so bad].
I compared the total sitemap URL generated by Needy script and sitemap generated by Option 3 (online sitemap generator).
Online sitemap generator URL count: 315
Needy script generator total URL count : 314
I am still not able to figure out the one that I am missing, but I happy I was able to achieve 99 % similar results.
This script will ping (if opted) Google as well as Bing after sitemap generation.
I am positive and probably will create a SQLite3 version & PostgreSQL version of this script soon.
Needy Ghost Sitemap Generator is hosted on github and ready to use. The Github repository readme cotains all the blah blah and usage information you require.
Feel free to contact in case of problems, bugs encountered, criticize or to say thanks.
Happy blogging !!