VOOZH about

URL: https://www.geeksforgeeks.org/python/how-to-add-rss-feed-and-sitemap-to-django-project/

⇱ How to add RSS Feed and Sitemap to Django project? - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

How to add RSS Feed and Sitemap to Django project?

Last Updated : 23 Jul, 2025

This article is in continuation of Blog CMS Project in Django. Check this out here - Building Blog CMS (Content Management System) with Django

RSS (Really Simple Syndication) Feed

RSS (Really Simple Syndication) is a web feed that allows users and applications to access updates to websites in a standardized, computer-readable format. These feeds can, for example, allow a user to keep track of many different websites in a single news aggregator. Django comes with an library to create atom feed for our blog. 

Creating views for RSS Feed - 

Go to blog app directory and create a file feeds.py and paste the below code.

Create Routes for RSS Feed - 

To route the RSS feed go to urls.py file of the app you are using for generating feed and add the route

Sample Feed

👁 Image
Sample Feed

Sitemap - 

Sitemap protocol allows a webmaster to inform search engines about URLs on a website that are available for crawling. A Sitemap is an XML file that lists the URLs for a site. It allows webmasters to include additional information about each URL: when it was last updated, how often it changes. This allows search engines to crawl the site more efficiently and to find URLs that may be isolated from the rest of the site's content.

Add sitemaps to INSTALLED_APPS -

Django also comes with a sitemaps creator go to the blog app directory and add sitemaps to installed apps in settings file

Create Sitemap - 

Create a file sitemaps.py and paste the below code.

Add absolute URL to model - 

Sitemap generated should have urls for our posts so we need to add a simple function to our model so that we sitemap library can generate posts urls

Routing for sitemap -

Now to generate the sitemap url, Go to urls.py file of the and add the route

Now you can see RSS feed and Sitemaps at assigned urls

Sample Sitemap

👁 Image
Sample Sitemap
Comment