NOTE: This article is 3 years or older so its information may no longer be relevant. Read on at your own discretion! Comments for this article have automatically been locked, refer to the FAQ
for more details.
I could not find a FlatPress sitemap generator, the one that was available previously seems to be down now, so I've decided to write my own based on some of the SQL export code on the FlatPress wiki.
Here's the result, place this in the same directory as index.php and call it sitemap.php.
This script will generate a Google compatible sitemap for the whole blog.
There are some limitations:
- Will not work if there are more than 50,000 entries in the blog
- Categories are not included
- Each blog entry last updated date is the blog entry date, not the date of the last comment for the entry
Edit: the original version of this code didn't take the time offset into account, I've updated it now to use the offset. Without the offset, the URLs are not created correctly sometimes.
Edit 2: changed the locations to use permalinks instead of the pretty URLs because I've noticed a large number of the URLs were not being generated correctly due to the time offsets.
Edit 3: the escape slashes got stripped out in the original code, I've changed the code so escapes are not required.
Hope you found this post useful...
...so please read on! I love writing articles that provide beneficial information,
tips and examples to my readers. All information on my blog is provided free of
charge and I encourage you to share it as you wish. There is a small favour I ask in return however -
engage in comments below, provide feedback, and if you see mistakes let me know.
If you want to show additional support and help me pay for web hosting and
domain name registration,
donations, no matter how small, are always welcome!
Use of any information contained in this blog post/article is subject to this disclaimer
Other posts you may like...