Setting up a Django project for SEO


(Luke) #1

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


(Vitor Freitas) #2

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


(Luke) #3

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!


(Cleiton Lima) #4

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


(liketotravel) #5

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.


(Luke) #6

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:


(Devil) #7

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 urls.py why would you use third party plugin for it.

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


(Cleiton Lima) #8

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:


(Cleiton Lima) #9

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

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


(Devil) #10

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

User-Agent: *
Disallow:

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


(Cleiton Lima) #11

HAHAHA

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

Good question :thinking:


(Devil) #12

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


(Oleg Kleschynov) #13

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.