Skip to content

Commit 0809583

Browse files
committed
fix: Update readme to explain template structure
1 parent 313f8cd commit 0809583

File tree

2 files changed

+28
-3
lines changed

2 files changed

+28
-3
lines changed

README.rst

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,9 +132,34 @@ Alias plugin
132132
Alternatively, aliases can be used with the Alias plugin. It allows to select which alias content is shown at the
133133
exact position the alias plugin is placed.
134134

135-
Side notes
135+
Teemplates
136136
==========
137137
For the plugin to work out of the box ``{% block content %}`` is expected to exist in your main ``base.html`` file.
138+
Here is the template hierarchy for the edit and preview endpoints::
139+
140+
base.html
141+
└── djangocms_alias/base.html {% block content %}
142+
└── djangocms_alias/alias_content_preview.html {% block alias_content %}
143+
144+
Use Django's template override mechanism to customize these templates as needed. Say, if your base template has
145+
a different name and the content goes into a block called `main_content`, you would create a template at
146+
`templates/djangocms_alias/base.html` with the following content::
147+
{% extends "mybase.html" %}
148+
{% load i18n %}
149+
150+
{% block title %}{% translate "Aliases" %}{% endblock %}
151+
152+
{% block breadcrumb %}{% endblock %}
153+
{% block footer %}{% endblock %}
154+
155+
{% block main %}
156+
<div class="aliases my-additional-class">
157+
{% block aliases_content %}
158+
{% endblock aliases_content %}
159+
</div>
160+
{% endblock main %}
161+
162+
138163

139164
.. |PyPiVersion| image:: https://img.shields.io/pypi/v/djangocms-alias.svg?style=flat-square
140165
:target: https://pypi.python.org/pypi/djangocms-alias

djangocms_alias/templates/djangocms_alias/base.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{% extends "base.html" %}
2-
{% load i18n static sekizai_tags %}
2+
{% load i18n %}
33

4-
{% block title %}{% trans "Aliases" %}{% endblock %}
4+
{% block title %}{% translate "Aliases" %}{% endblock %}
55

66
{% block breadcrumb %}{% endblock %}
77
{% block footer %}{% endblock %}

0 commit comments

Comments
 (0)