Skip to content

Commit

Permalink
Doc improvements for usage with djangocms-page-meta
Browse files Browse the repository at this point in the history
  • Loading branch information
yakky committed Aug 19, 2020
1 parent ee6ce05 commit d3cf202
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 17 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
30 changes: 15 additions & 15 deletions djangocms_blog/templates/djangocms_blog/base.html
Original file line number Diff line number Diff line change
@@ -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

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

{% endcomment %}
{% if meta %}
{% endcomment %}
{% include "meta/meta.html" %}
{% endif %}
{% endblock meta %}
{% endblock meta %}
{% endif %}

{% block content %}
<div class="app app-blog">
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 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 %}
<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.
1 change: 1 addition & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ skip_install = true
commands =
{envpython} -m invoke docbuild
deps =
django<3.1
invoke
sphinx
sphinx-rtd-theme
Expand Down

0 comments on commit d3cf202

Please sign in to comment.