Theme module templates

Boilerplate templates for the customizable module templates available when editing a custom Theme

blog - posts list

This template controls both the "list" view for the blog module subpages. This includes the blog root, archive pages and category pages.

{% if posts %}
    {% for post in posts %}
        <article itemscope="" itemtype="http://schema.org/BlogPosting">
            <h2 itemprop="name headline">
                <a href="{{ post.external_url or post.url(**post_url_params) }}" title="{{ post.title }}">{{ post.title }}</a>
            </h2>
            <p datetime="{{ post.date|datetimefmt(format='yyyy-MM-ddTHH:mm') }}" itemprop="datePublished dateModified">{{ post.date|datefmt(format='long') }}</p>
            {% if post.content %}
            <div itemprop="articleBody">
                {% if show_full_posts %}
                    {{ post.content|safe }}
                {% else %}
                    {% if post.featured_img %}
                        <p itemprop="image" itemscope itemtype="https://schema.org/ImageObject">
                            <img alt="{{ post.title }}" src="{{ post.featured_img.src }}" style="{{ post.featured_img.style }}" itemprop="image"/>
                        </p>
                    {% endif %}
                    <p>{{ post.content|striptags|truncatewords_html(75) }}</p>
                    <p><a href="{{ post.external_url or post.url(**post_url_params) }}" title="{{ post.title }}">{% trans %}Read more{% endtrans %}..</a></p>
                {% endif %}
            </div>
            {% endif %}
        </article>
    {% endfor %}
    <div>
        {% if posts.has_previous() %}
            <a href="{{ posts.prev_link }}">{% trans %}Previous Page{% endtrans %}</a>
        {% endif %}
        {% if posts.has_next() %}
            <a href="{{ posts.next_link }}">{% trans %}Next Page{% endtrans %}</a>
        {% endif %}
    </div>
{% else %}
    <p>{% trans %}No posts have been added{% endtrans %}
{% endif %}

blog - post detail

This template controls the single post page for each blog post.

<article class="post" itemscope="" itemtype="http://schema.org/BlogPosting">
    <h1 itemprop="name headline">{{ post.title }}</h1>
    <p datetime="{{ post.date|datetimefmt(format='yyyy-MM-ddTHH:mm') }}" itemprop="datePublished dateModified">{{ post.date|datefmt(format='long') }}</p>
    {% if post.content %}
    <div itemprop="articleBody">
        {{ post.content|safe }}
    </div>
    {% endif %}
</article>

blog - recent posts

Widget used to show the recent posts on a site's blog. Normally used in footers or other parts of pages outside the main blog pages.

{% for post in posts[:3] %}
    <div>
        <p>
            {% if post.featured_img %}
                <img alt="{{ post.title }}" src="{{ post.featured_img.src }}" />
            {% else %}
                <img alt="{{ post.title }}" src="/img/upload/blogdefault.jpg" />
            {% endif %}
        </p>
        <p><a href="{{ post.url(**post_url_params) }}">{{ post.title }}</a></p>
    </div>
{% endfor %}

directory - cities_list

<div>
  <a href="{{ directory_root }}">{% trans %}Directory{% endtrans %}</a>{% if country_name %} > <a href="{{ country_href }}">{{ country_name }}</a>{% endif %} > {{ state_name }}
</div>
<h1>{{ site.business.business_name }} {% trans %}in{% endtrans %} {{ state_name }}</h1>
<ul>
  {% for city in cities %}
    <li><a href="{{ city.href }}">{{ city.city }}{% if city.number %} ({{ city.number }}){% endif %}</a></li>
  {% endfor %}
</ul>

directory - countries_list

<ul>
{% for country in countries %}
  <li><a href="{{ country.href }}">{{ country.country }}{% if country.number %} ({{ country.number }}){% endif %}</a></li>
{% endfor %}
</ul>

directory - sites_list

<div>
    <a href="{{ directory_root }}">{% trans %}Directory{% endtrans %}</a>{% if country_name %} > <a href="{{ country_href }}">{{ country_name }}</a>{% endif %} > <a href="{{ state_href }}">{{ state_name }}</a> > {{ city }}
</div>
<ul>
<h1>{{ site.business.business_name }} {% trans %}in{% endtrans %} {{ city }}, {{ state_name }}</h1>
{% for result in results %}
  <li>
    <a href="{{ result.site.formatted_url }}">{{ result.site.title }}</a>
    <span>{{ result.location.formatted_address }}</span>
  </li>
{% endfor %}
</ul>

directory - statesprovs_list

<div>
  <a href="{{ directory_root }}">{% trans %}Directory{% endtrans %}</a>{% if country_name %} > {{ country_name }}{% endif %}
</div>
{% if country_name %}
<h1>{{ site.business.business_name }} {% trans %}in{% endtrans %} {{ country_name }}</h1>
{% endif %}
<ul>
{% for state in states %}
  <li><a href="{{ state.href }}">{{ state.state }}{% if state.number %} ({{ state.number }}){% endif %}</a></li>
{% endfor %}
</ul>

Last updated