nephila / djangocms-page-meta

OpenGraph, Twitter Card and Google+ snippet tags for django CMS 3 pages
https://djangocms-page-meta.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
59 stars 64 forks source link

Managing robots meta tag in djangocms-page-meta #116

Closed corentinbettiol closed 1 year ago

corentinbettiol commented 4 years ago

Hello :wave:

I would like to know if you would accept a PR adding robots meta tags management in djangocms-page-meta.

I noticed that the meta robots tag configuration is already possible in your djangocms-page-sitemap application, but I think that this option would be more appropriate in an application that manages meta tags rather than in an application that manages a sitemap, because we don't necessarily use both applications together, so we may end up in a situation where we can configure meta tags using djangocms-page-meta, except the meta tag robots because we don't have installed djangocms-page-sitemap.

Here is how I think I would add it: image

yakky commented 4 years ago

@corentinbettiol it sounds really nice Going forward, I'd think about a way to import data from djangocms-page-sitemap and then remove the feature from sitemap completely

corentinbettiol commented 4 years ago

I started to implement it here using django-multiselectfield.

It looks like a basic checklist: image

And adds the selected values (separated by commas) inside the robots meta tag: image

Do you think I can add another thing, or can I create a PR ?

yakky commented 4 years ago

@corentinbettiol I gave a cursory look at the linked branch, overall speaking it's ok Please check

corentinbettiol commented 4 years ago

@yakky Okay, I'll do that :)

But the labels are the exact keywords that we can add to robots meta tag, so I don't know if we should make them translateable.

yakky commented 4 years ago

@corentinbettiol I would mark them as translatable anyway (only the "right" part of the tuple, not the left of course) Generally speaking it may not make sense to translate them, but this will make make easy for people to provide custom label in their project, if they want But I was more referring to the robots field which does not provide a verbose_name and it's not translatable

corentinbettiol commented 4 years ago

Hmm yes I understand, lets do this then :)

yakky commented 4 years ago

I would also expose ROBOTS_CHOICES as a setting (with the default you wrote) to allow further customizations / updates in the future

corentinbettiol commented 4 years ago

Oh nice idea, I will add this too, thanks.

corentinbettiol commented 4 years ago

@yakky Can I add some information on django-meta configuration doc too?

Something like this:

Basic django-meta configuration:

In settings.py:

META_SITE_PROTOCOL = 'http'  # OR 'https'
META_USE_SITES = True  # OR META_SITE_DOMAIN='example.com'

In templates/bases.html:

{% load cms_tags menu_tags sekizai_tags page_meta_tags %}
{% page_meta request.current_page as page_meta %}
...
<head>
...
{% include 'djangocms_page_meta/meta.html' with meta=page_meta %}
</head>
...

(just discovered that github-flavored markdown supports html + django templates in it's syntax highlighting module)


yakky commented 4 years ago

@yakky Can I add some information on django-meta configuration doc too?

Sure! Any addition / clarification to the documentation is of great help :tada:

WRT to test, I think assigning some values to the field in the test setup and checking the rendered values it's enough to cover the case. Any other would just be testing the depedencies

protoroto commented 1 year ago

@corentinbettiol Hi! Just so you know, we've released a new version with this feature!

corentinbettiol commented 1 year ago

@protoroto @yakky That's awesome! Thank you very much!