Today, I needed to create an xml sitemap for all the pdf files under a directory as well as inside the sub directories of that directory. Doing that manually requires lot’s of time and energy and that is a complete waste.
So, I started digging and created a very small php script that will list all the pdf files inside the specified directory & serves as an xml sitemap. It made the job done in just a few minutes whereas, manual creation could take hours.
The script is available on github, so you can also use this script which may help you to save some of your valuable time.
Click here to go to github page
The repo currently contains a file that can be used to generate sitemap for pdf’s but you can easily customize it to use for other file formats. I’ll add a few more file type example files soon as well.
That’s it for today, let me know if you have any question about this.
Hi Abdul,
Love your work ! 🙂
but, I can’t quite get this one to run for me (Dynamic Sitemap) – displays blank screen)
– Should the code end on line 33 with echo ”; ?
– if i wish to do whole site, including root, what would you suggest is my ‘folder/path/here’
Many thanks.
Peter
Hi Peter,
1. I am not sure if the code is truncated in the comment, so not being able to provide a comment on the first one. It should be how it is on github repo.
2. I think you can put the file on root dir and use ‘/’ in place of ‘folder/path/here/’ . Please let me know if that helps.
Thank You
Uzzal