I need a little help with sitemap XML. I crate XML like that:
<loc>https://www.example.si/good</loc><lastmod>2022-02-09</lastmod><image:image><image:loc>https://poster.domain.si/good.jpg</image:loc></image:image></url></urlset>
How can I add PDF file (example: poster.example.si/good.PDF
) into sitemap.xml
?
PDF documents "pages" just like HTML documents to search engines. You would add them as separate <url><loc>
items like this:
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">
<url>
<loc>https://www.example.si/good</loc>
<image:image><image:loc>https://poster.domain.si/good.jpg</image:loc></image:image>
</url>
<url><loc>https://poster.example.si/good.PDF</loc></url>
</urlset>
I removed lastmod
from your sitemap because it is an optional field and search engines almost never use it. It isn't worth including