From d3cf202f38d1288e9e1a7a30e9c709e12d5b79b8 Mon Sep 17 00:00:00 2001 From: Iacopo Spalletti Date: Thu, 20 Aug 2020 00:36:12 +0200 Subject: [PATCH] Doc improvements for usage with djangocms-page-meta --- changes/613.bugfix | 1 + .../templates/djangocms_blog/base.html | 30 +++++++++---------- docs/features/meta.rst | 19 ++++++++++-- tox.ini | 1 + 4 files changed, 34 insertions(+), 17 deletions(-) create mode 100644 changes/613.bugfix diff --git a/changes/613.bugfix b/changes/613.bugfix new file mode 100644 index 00000000..e966dbfb --- /dev/null +++ b/changes/613.bugfix @@ -0,0 +1 @@ +Doc improvements for usage with djangocms-page-meta diff --git a/djangocms_blog/templates/djangocms_blog/base.html b/djangocms_blog/templates/djangocms_blog/base.html index d97a67e2..8526af32 100644 --- a/djangocms_blog/templates/djangocms_blog/base.html +++ b/djangocms_blog/templates/djangocms_blog/base.html @@ -1,24 +1,24 @@ {% extends CMS_TEMPLATE %} -{% block meta %} - {% comment %} - This is needed if you can't add ``{% include "meta/meta.html" %}`` in the django CMS template attached to the blog - page. - If you have something like the snippet below in the main template used by the django CMS page, you don't need - this block and you can safely remove it when customizing the blog templates +{% if meta %} + {% block meta %} + {% comment %} + This is needed if you can't add ``{% include "meta/meta.html" %}`` in the django CMS template attached to the blog + page. + If you have something like the snippet below in the main template used by the django CMS page, you don't need + this block and you can safely remove it when customizing the blog templates - ... - - - {% block title %}{% page_attribute 'title' %}{% endblock title %} - {% include "meta/meta.html" %} ... + + + {% block title %}{% page_attribute 'title' %}{% endblock title %} + {% include "meta/meta.html" %} + ... - {% endcomment %} - {% if meta %} + {% endcomment %} {% include "meta/meta.html" %} - {% endif %} -{% endblock meta %} + {% endblock meta %} +{% endif %} {% block content %}
diff --git a/docs/features/meta.rst b/docs/features/meta.rst index a7dd1cb0..7ba9887c 100644 --- a/docs/features/meta.rst +++ b/docs/features/meta.rst @@ -30,7 +30,7 @@ In order to enable its rendering you must follow two steps: a. The recommended way is to include in your project base templates: .. code-block:: html+django - :name: my_base.html + :name: base_a.html @@ -42,7 +42,7 @@ In order to enable its rendering you must follow two steps: for the blog posts: .. code-block:: html+django - :name: base.html + :name: base_b.html @@ -50,4 +50,19 @@ In order to enable its rendering you must follow two steps: {% block meta %}{% endblock meta %} ... + c. If you are also using ``djangocms-page-meta`` use this bas base template to make the two packages interoperable: + + .. code-block:: html+django + :name: base_c.html + + {% load page_meta_tags %} + {% page_meta request.current_page as page_meta %} + + + {% block title %}{% page_attribute 'title' %}{% endblock title %} + {% block meta %} + {% include 'djangocms_page_meta/meta.html' with meta=page_meta %} + {% endblock meta %} + ... + For complete social meta tags rendering, configure default properties (see ``BLOG_FB``, ``BLOG_TWITTER``, ``BLOG_GPLUS``/``BLOG_SCHEMAORG`` in :ref:`settings`) and apphook ones. diff --git a/tox.ini b/tox.ini index d3924bde..619f8d0b 100644 --- a/tox.ini +++ b/tox.ini @@ -84,6 +84,7 @@ skip_install = true commands = {envpython} -m invoke docbuild deps = + django<3.1 invoke sphinx sphinx-rtd-theme