XML sitemap for PDFs

When you upload a PDF to your site, you’ll usually want it to be found. Unfortunately, PDFs are handled a bit weird in WordPress sometimes. This very simple plugin, that has no settings whatsoever, ties into the Yoast SEO XML sitemaps. It creates an XML sitemap for all the PDFs ever uploaded to your site in one go. This specific XML sitemap is also added to your site’s index sitemap, so you can easily find it.

Screenshot of the PDF XML sitemap in action.

Frequently asked questions

Will this include PDFs uploaded through forms?

The plugin only scans folders with numeric names, so it won’t add files that have been uploaded through forms.

Does this plugin cache its output?

Yes, the plugin scans the uploads folder once per day and saves that data to a transient. When you upload a new PDF file that cache is cleared automatically.

Does this plugin work on multisite?

This plugin has not been tested on multisite.

Filters

The PDF XML sitemap plugin has the following filters:

FilterDescription
joost/pdf-sitemap/filetypesAllows filtering which filetypes we’re adding to the XML sitemap. Just pdf by default.
joost/pdf-sitemap/cache-timeAllows filtering how long the plugin caches the scanned PDFs for. Value needs to be in seconds. Defaults to one day. Note: setting to 0 will mean cache indefinitely, not disable it.
joost/pdf-sitemap/pdfsAllows filtering the PDFs being output.

Get the plugin

Want to get the plugin? Search for pdf sitemap in your WP admin or download the plugin from WordPress.org!

Download

Download the plugin on WordPress.org:

GitHub

Want to follow development, submit an issue or a patch? Come to the GitHub repo.