Setting up a Django project for SEO

Hi, @vitor, love the site! I think a really interesting topic would be about setting up a django project to follow SEO best practices.


That’s a good topic – actually Django have many built-in goodies for content-driven Django sites like RSS/Atom, redirects framework, sitemaps, etc.

Not sure if there’s a good third-party app to provide some support to SEO, but for the most part it will be implemented on the templates/HTML

After reading a little about it, I’m starting to use django-meta in combination with the built-in sitemaps. I figure that there’s even more than can be done (and probably with much more eloquence :slight_smile:) – SEO really isn’t my forte. I’d love to see how folks with more knowledge & experience do it!

1 Like

I have been using this app constantly. I also use django-robots.

1 Like

I just hardcode the basic data for seo in base.html and then reappy it for dynamic pages or simply hardcode it to html it for some various static pages like Contact Us, FAQ etc.

1 Like

Thanks for telling us about django-robots, @Cleiton, that’s one I hadn’t come across before! Do you have any tips for django-meta or django-robots? My only experience with trying to make sites SEO-friendly was helping people with WordPress sites…and in that case, most everything was taken care of for you by plugins. Guess I just need to read more about it :grin:

Wait! So django-robots is only for sitemap and robots.txt file?

Sitemap is intrigated in Django and robots.txt needs only one line code in why would you use third party plugin for it.

For SEO a good plugin for meta tags is all you need.

What I use for SEO is sitemaps, django-meta and django-robots.

To use django-meta it has no secret. You can either configure it at the model level or apply some attributes to the view. As seen in the documentation itself.

I’m no SEO expert either! :sweat_smile::sweat_smile:

1 Like

No, robots.txt has is used for other purposes.

In django-robots you can configure the urls and the rules to access them.

Yeah Still I use the simplest of them all :grimacing:

User-Agent: *

Just curious, Is there any way to stop scrappers from robots.txt file?


In some projects I add /admin url in Disallow. Each case is different :sweat_smile:

Good question :thinking:

I don’t do this intentionally to hide my admin panel url, I never set it to /admin

1 Like

If you need to add meta tags and OG properties to a template response of your views, you can try my package: django-ok-seo. Maybe, you will find it usefull.

1 Like