nephila / django-meta

Pluggable app to allow Django developers to quickly add meta tags and OpenGraph, Twitter, and Google Plus properties to their HTML responses.
https://django-meta.readthedocs.io
Other
484 stars 68 forks source link

robots choice feature should be added for stronger SEO #129

Open pymeister opened 3 years ago

pymeister commented 3 years ago

Description

I would like to add index, follow or no index, nofollow to certain pages.

Use cases

for SEO purposes the crawler can identify wich page need to be crawled, index or not crawled

Proposed solution

I've tried something like this but it doesn't work: ROBOTS_PARAMETERS = ( "index, follow", "index, nofollow", "noindex, nofollow", "index, follow, nosnippet", "index, nofollow, nosnippet", "noindex, nofollow, nosnippet", "noimageindex, nofollow, nosnippet", "none", )

metarobots = models.IntegerField( ("Meta Robots"), null=True, choices=tuple(enumerate(sorted(ROBOTS_PARAMETERS))) ) _metadata = { 'title': 'title', 'description': 'abstract', 'robots': 'meta_robots', 'extra_props': { 'robots': meta_robots, },

in the html for robots content it just shows "meta_robots" instead of the selected meta robot directive.

maybe something can be added to this approach to make it work or meta_robots could be built in.

yakky commented 2 years ago

@LanceMeister thanks for your report. From the top of my head your code should work, but I will investigate more on the issue.