Skip to content

Commit

Permalink
Doc improvements for usage with djangocms-page-meta (#630)
Browse files Browse the repository at this point in the history
* Doc improvements for usage with djangocms-page-meta
* Fix template for correct block inheritance

Co-authored-by: W. Bomar <62723358+tacc-wbomar@users.noreply.github.com>
  • Loading branch information
yakky and wesleyboar committed Aug 26, 2020
1 parent f47916d commit 12a2141
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 12 deletions.
1 change: 1 addition & 0 deletions changes/613.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Doc improvements for usage with djangocms-page-meta
15 changes: 5 additions & 10 deletions djangocms_blog/templates/djangocms_blog/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,15 @@
{% 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

...
<html>
<head>
<title>{% block title %}{% page_attribute 'title' %}{% endblock title %}</title>
{% include "meta/meta.html" %}
...
page or if you use djangocms-page-meta.

Please check the documentation at https://djangocms-blog.readthedocs.io/en/latest/features/meta.html for more
details about the correct template configuration for social media tags rendering.
{% endcomment %}
{% if meta %}
{% include "meta/meta.html" %}
{% else %}
{{ block.super }}
{% endif %}
{% endblock meta %}

Expand Down
19 changes: 17 additions & 2 deletions docs/features/meta.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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

<html>
<head>
Expand All @@ -42,12 +42,27 @@ 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

<html>
<head>
<title>{% block title %}{% page_attribute 'title' %}{% endblock title %}</title>
{% block meta %}{% endblock meta %}
...

c. If you are also using ``djangocms-page-meta`` use this 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 %}
<html>
<head>
<title>{% block title %}{% page_attribute 'title' %}{% endblock title %}</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.

0 comments on commit 12a2141

Please sign in to comment.