Wednesday 31 August 2022

Django Google News Sitemap

Does anyone know how to implement the google news sitemap standard on Django? https://developers.google.com/search/docs/advanced/sitemaps/news-sitemap

I am struggling to find any mention of how its implemented with Django.

Example of how it should look.

<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
        xmlns:news="http://www.google.com/schemas/sitemap-news/0.9">
  <url>
   <loc>http://www.example.org/business/article55.html</loc>
   <news:news>
   <news:publication>
     <news:name>The Example Times</news:name>
     <news:language>en</news:language>
   </news:publication>
   <news:publication_date>2008-12-23</news:publication_date>
     <news:title>Companies A, B in Merger Talks</news:title>
    </news:news>
  </url>
</urlset>

What I currently have looks very simple.

<url>
<loc>https://mynewsite.net/news/this-news-article/</loc>
<lastmod>2022-04-04</lastmod>
</url>
<url>


from Django Google News Sitemap

No comments:

Post a Comment