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 aa8f21a
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 6 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
8 changes: 4 additions & 4 deletions djangocms_blog/templates/djangocms_blog/base.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{% extends CMS_TEMPLATE %}

{% block meta %}
{% 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.
Expand All @@ -15,10 +16,9 @@
...

{% endcomment %}
{% if meta %}
{% 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 aa8f21a

Please sign in to comment.