djangocms-page-meta icon indicating copy to clipboard operation
djangocms-page-meta copied to clipboard

Managing robots meta tag in djangocms-page-meta

Open corentinbettiol opened this issue 5 years ago • 10 comments

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

corentinbettiol avatar Feb 26 '20 09:02 corentinbettiol

@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

yakky avatar Mar 18 '20 13:03 yakky

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 ?

corentinbettiol avatar Apr 24 '20 15:04 corentinbettiol

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

  • user facing labels are translateable
  • at least a test for the proposed feature is added
  • no extra code changes (formatting, code style, unrelated fixes) are present in the proposed commits

yakky avatar Apr 24 '20 16:04 yakky

@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.

corentinbettiol avatar Apr 27 '20 09:04 corentinbettiol

@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

yakky avatar Apr 27 '20 09:04 yakky

Hmm yes I understand, lets do this then :)

corentinbettiol avatar Apr 27 '20 09:04 corentinbettiol

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

yakky avatar Apr 27 '20 11:04 yakky

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

corentinbettiol avatar Apr 27 '20 11:04 corentinbettiol

@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)


  • [x] user facing labels are translateable
  • [x] no extra code changes (formatting, code style, unrelated fixes) are present in the proposed commits
  • [x] at least a test for the proposed feature is added (don't know if this count)

corentinbettiol avatar Apr 27 '20 12:04 corentinbettiol

@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

yakky avatar May 02 '20 19:05 yakky

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

protoroto avatar Aug 07 '23 10:08 protoroto

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

corentinbettiol avatar Aug 07 '23 14:08 corentinbettiol