Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doc improvements for usage with djangocms-page-meta #630

Merged
merged 4 commits into from
Aug 26, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.