DevHub Docs
  • Welcome
  • Analytics
    • What events are tracked automatically?
    • Custom events
    • Google Analytics
  • API documentation
  • Domains
    • Registering a new domain
    • Renewing a domain
    • Pointing an existing domain
    • Pointing a subdomain of an existing domain
    • Transfer a domain
      • Transfer a domain to another registrar
    • Validating your domain
      • Validate with Google Webmaster Tools
    • Domain expiration process
  • Email accounts
    • Hosted email (rackspace)
      • Configure email clients to use POP or IMAP
  • Forms
    • Form and field options
    • Using fieldsets
    • Spam filtering
    • Configure SMTP For outbound emails
    • Using Marketo forms
  • Google Sheets
  • Hosting options
    • Embed pages
    • Wordpress plugin for path override
    • Server path override
      • Apache configuration
      • IIS configuration
      • NGINX configuration
    • CDN (content delivery network) support
  • Maps
    • Location finder
    • Map options explained
    • Google Maps API keys
  • Privacy
    • OneTrust integration
    • Cookies
  • Reverse proxy
    • Privacy and security
    • Proxy Configuration
    • Proxy Gating
    • Form lead tracking
    • Blocking and Whitelisting
      • Whitelisting Options
      • Google Ads rejections or disapprovals
      • 3rd Party Services/Widgets
      • Common Security System Restrictions or Domain Errors
  • SEO
    • Schema.org support
    • Sitemap XML
    • Enable No Index
  • Site builder
    • Getting Started
    • Images and video
    • Pages and content
      • Using page drafts
      • Adding Text
      • Adding and Managing Pages
      • Adding Images
      • Page templates and Templated pages
      • Maps
    • Redirects
    • Site Settings
    • Style Options
    • Adding a Business and location
    • Adding a site
    • Adding a user
    • Adding Custom Forms
    • Adding HTML to Sites or Pages
    • Blogs
  • SSL and security
    • SSL Troubleshooting
    • SSL certificate install options
      • Use your own purchased SSL certificate
    • Enable HTTPS for Sites and Proxies
  • Support
    • Creating a Zendesk account
    • Ticketing submission workflow
    • Builder URL and Site ID
  • Themes and custom templates
    • Getting started
    • Using macros
    • Using custom fields
    • Using URL parameters
    • Hours of operation
    • Using date and time in templates
    • Template variables
    • Site Builder Markup
      • Avoiding Site Builder CSS and HTML duplication
    • Example themes
      • Location focused page with bootstrap
      • Store locator theme example
    • Advanced Examples
      • Theme module templates
      • Static Google maps
      • Content translations
      • Page navigation
      • Override page title and meta tags
      • Adding line breaks to content
      • Get objects
      • Handling boolean values
      • Right to left languages
      • Access current URL
      • Social sharing links
      • Standard filters
      • Serializing data to JSON
      • Form events
      • Schema.org FAQ utility
  • Trace technology
    • What is Trace?
    • Configuration options
  • Data Sources
    • External Contexts
Powered by GitBook
On this page
  • blog - posts list
  • blog - post detail
  • blog - recent posts
  • directory - cities_list
  • directory - countries_list
  • Basic list of countries
  • List of countries and the states/provinces
  • directory - sites_list
  • directory - statesprovs_list

Was this helpful?

  1. Themes and custom templates
  2. Advanced Examples

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

Basic list of countries

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

List of countries and the states/provinces

<ul>
{% for country in countries %}
  <li>
    <a href="{{ country.href }}">{{ country.country }}{% if country.number %} ({{ country.number }}){% endif %}</a>
    {% if country.states %}
      <ul>
        {% for state in country.states %}
          <li><a href="{{ state.href }}">{{ state.state_name }} - {{ state.state }}</a></li>
        {% endfor %}
      </ul>
    {% endif %}
  </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>
PreviousAdvanced ExamplesNextStatic Google maps

Last updated 5 months ago

Was this helpful?