Skip to content

Commit

Permalink
Merge 9f14176 into 1433dcd
Browse files Browse the repository at this point in the history
  • Loading branch information
yakky committed Jun 24, 2020
2 parents 1433dcd + 9f14176 commit c959220
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 6 deletions.
1 change: 1 addition & 0 deletions changes/595.bugfix
@@ -0,0 +1 @@
Clarify documentation regarding templates customization
28 changes: 22 additions & 6 deletions docs/features/templates.rst
Expand Up @@ -18,17 +18,30 @@ will ignore the bundled one.
Templates set
*************

By using **Apphook configuration** you can define a different templates set.
To use this feature provide a directory name in **Template prefix** field in
the **Apphook configuration** admin (in *Layout* section): it will be the
root of your custom templates set.
You can provide a different set of templates for the whole ``djangocms-blog`` application by configuring
the ``Blog configs`` accordingly.

This would require you to customize **all** the templates shipped in ``djangocms_blog/templates/djangocms_blog``; the easiest
way would be to copy the **content** of ``djangocms_blog/templates/djangocms_blog`` into another folder in the ``templates``
folder in our project
(e.g., something like ``cp -a djangocms_blog/templates/djangocms_blog/* /path/my/project/templates/my_blog``).

To use the new templates set, go to the ``Blog configs`` admin
(something like ``http://localhost:8000/en/admin/djangocms_blog/blogconfig/1/change``) and enter a directory name in the
**Template prefix** field in the **Apphook configuration** admin (in the *Layout* section): it will be the
root of your custom templates set; following the example above, you should enter ``my_blog`` as directory name.

For more instruction regarding template override, please read Django documentation: `Overriding templates`_ (for your version of Django).


****************
Plugin Templates
****************

Plugin templates live in the ``plugins`` folder of the folder specified by the **Template prefix**,
or by default ``djangocms_blog``.
You can have different layouts for each plugin (i.e.: ``Latest Blog Articles``, ``Author Blog Articles List`` etc), by
having multiple templates for each plugin.
Default plugin templates are located in the ``plugins`` folder of the folder specified by the **Template prefix**;
by default they are located in ``templates/djangocms_blog``.

By defining the setting ``BLOG_PLUGIN_TEMPLATE_FOLDERS`` you can allow multiple sets of
plugin templates allowing for different views per plugin instance. You could, for example,
Expand All @@ -48,3 +61,6 @@ Example:
)
Once defined, the plugin admin interface will allow content managers to select which template the plugin will use.


.. _overriding templates: https://docs.djangoproject.com/en/dev/howto/overriding-templates/#overriding-templates

0 comments on commit c959220

Please sign in to comment.