Hello,
I apologize for the issue you are facing with your sitemap not including URLs for the PDFs in your "documents" subdirectory. Thank you for raising this concern.
To ensure that your PDFs are included in the sitemap generated by Rank Math, you can follow these steps:
-
Check Rank Math Settings: Go to the Rank Math dashboard and navigate to Sitemap Settings. Ensure that the option to include media files in the sitemap is enabled. This setting allows Rank Math to include attachments like PDFs in the sitemap.
-
Verify PDF Uploads: Make sure that the PDFs are properly uploaded to your WordPress Media Library and that they are accessible via direct URLs. You can check this by trying to access the PDF URLs directly in your browser.
-
Regenerate Sitemap: After confirming the settings, regenerate your sitemap. You can do this by going to Rank Math > Sitemap Settings and clicking on the Save Changes button. This action should refresh the sitemap and include any new media files.
-
Check Robots.txt: Ensure that your robots.txt
file is not blocking search engines from accessing the PDFs. You can check this by navigating to yoursite.com/robots.txt
and looking for any disallow rules that might affect your PDFs.
-
Submit Sitemap to Google Search Console: After regenerating the sitemap, submit it again to Google Search Console. This will prompt Google to crawl the updated sitemap and index any new URLs included.
If you have followed these steps and still do not see the PDFs in your sitemap, please reply to this ticket with your site URL so we can investigate further. A human agent from our support team will be able to assist you more effectively.
Thank you for your patience, and we look forward to resolving this issue for you!
Sources:
Can I NoIndex PDF Files Using an SEO Plugin? » Rank Math
Can I NoIndex PDF Files Using an SEO Plugin? » Rank Math
Thanks, but I do not see any setting under “Sitemap Settings” to “Include Media Files” – I do not see the word Media under any of the Sitemap Settings options. Also, as noted in my original text, we are NOT using the WP Media upload option because it puts the PDF in stupidly organized and named default directories. The PDFs are placed into a directory named “documents” that we created using the File Manager plugin. Also, I have confirmed that all of the PDFs ARE accessible through direct URLs by typing them into my browser, and the PDFs are correctly loaded. Thx
Hello,
To include your attachments/pdf files in your sitemap, you’ll just need to make sure they are set to index and your attachments pages are not getting redirected.
Once done, you can enable the attachments in Rank Math > Sitemap Settings:
https://rankmath.com/kb/configure-sitemaps/#media
Looking forward to helping you.
hello – thanks for your reply, but please be more specific: For a PDF file in a subdirectory, exactly how does one “make sure they are set to index”? I can see that for a web page (html doc) in WP, Rank Math shows a way to look at this attribute, but Rank Math does not see PDFs and therefore how do I check the attribute? I will also share the reminder again that the PDFs are NOT part of the rather useless WP Media Library and one of its stupidly named directories. The PDFs live in a subdirectory called “documents” under the root directory that was created using the File Manager plugin – every thing in the directory is fully visible through my web hosting file manager tool and fully accessible to URLs that include the directory. How exactly do I “make sure they are set to index”? Or, does your plugin just assume that any PDFs are going to be in one of the stupidly named WP Media Library subdirectories? Regarding enabling “attachments” in Rank Math: We are in a website environment, not sending emails. Why in the world do you use the terminology “attachments” in your plugin in a web environment. The PDFs are documents, in directories, accessible through URLs – they are not “attached” to anything (they are not photos attached to a blog). But, I have gone ahead and turned off redirection of “attachments” to the original post and then turned on indexing of attachments. In doing so, I hope that now every image file on the site is not going to be in the sitemap – what a mess that would be! The PDFs I care about are product literature that have rich content and should be in the sitemap, as I know that Google finds them and indexes them. Thank you.
Hello,
Thank you for that explanation.
Since they are files inside your website directory, Rank Math cannot detect those and include them in the sitemap automatically.
Please note that Rank Math’s sitemap only includes the URLs from the posts/pages inside your WordPress.
In this case, you may need to create a custom sitemap for them by following this guide:
https://rankmath.com/kb/custom-sitemaps/
Looking forward to helping you.
Hello – thanks for confirming that Rank Math is not smart enough to look at the actual list of directories in public_html and ask which should be included in the sitemap. At least I will stop trying to get it to be smart. I also discovered that it absolutely refuses to let me tell it when to generate an updated sitemap and will only do it IF it feels like it or when IT feels like it – it is a total black box process. I appreciate you providing a link to the alternative – generating a manual sitemap, but why does that need to be so needlessly complicated? All you guys need to do is add function to the Rank Math sitemap feature that asks if any other publicly accessible directories / URLs, beyond the WordPerfect default ones, should be added to the sitemap. Then Rank Math could add them without the user having to go with a full manual sitemap process. At this point, I understand the significant limitations of the Rank Math sitemap function and will work within the plugin limitations going forward and establish workarounds to the plugins limitations.