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 1 commit
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
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:
yakky marked this conversation as resolved.
Show resolved Hide resolved

.. 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.