![]() |
Beginning of the divelog sitemap. |
Yesterday, Sunday 12 October 2025, I used OpenAI GPT-5 to create a PHP script to generate a GZip compressed sitemap - divelog-sitemap.xml.gz - for my phpDivingLog installation. After many gradual increments and much trial and error, it actually works!
It's very specific to my phpDivingLog installation. It handles a single-user diving log only. However, it wouldn't be too difficult to modify it to suit a different phpDivingLog installation.
The script resides in the root directory of my website, with phpDivingLog in a 'divelog' directory. The images used by my phpDivingLog setup are mainly in an 'images' sub-directory of 'divelog', with sub-directories per table. Though the equipment images are stored elsewhere.
I started handling the Logbook table, which includes the base URL for the list and the URLs for each dive. I didn't add the images for the dives into it. The divestats.php single URL is treated as a special case at the end, without images.
I used a special sitemap 'config.inc.php' file containing the database connection details. I didn't use all of the configuration details available in the main phpDivingLog config.inc.php file. My setup didn't like accessing my full config.inc.php file, so I had to place this smaller one outside of my divelog directory.
Then I added support for the City, Country, Equipment, Place, Shop and Trip tables. Again, just the base URL, plus the URLs for each entry.
Then I got ambitious and asked the AI to add the images for the City, Equipment, Place, Shop, and Trip tables, but not the Logbook and Pictures tables. There is at most one image per URL. The tiny flag images I have associated with the Country table were not worth including.
![]() |
divecity sitemap entries |
![]() |
divecountry sitemap entries |
![]() |
equipment sitemap entries |
![]() |
divesite sitemap entries |
![]() |
diveshop sitemap entries |
![]() |
divetrip sitemap entries |
With that working, it was time to tackle the Pictures table and the Dive Gallery images. Again, just the base URL, plus the URLs for each 'page' with 16 images per page. I have some 1,920 pictures already in my Diving Log, so that's 120 pages.
![]() |
divegallery sitemap entries |
Then I got ambitious and added titles and captions for the images from the City, Equipment, Place, Shop, Trip and Pictures tables.
With everything working, I added the program ID and a URL count to the screen and the sitemap.
![]() |
divestats sitemap entry, plus run details |
All done while watching the 2025 Bathurst 1000.
In total, my diving log sitemap has 955 URLs. It will be interesting to see how the search engines handle it over the coming weeks.
You can download it and try it for yourself at https://www.borrett.id.au/downloads/phpdivinglog-sitemap-generator-v01.zip