themes/unitexgramlab/templates/blog.html.twig
{% extends 'partials/base.html.twig' %}
{% set show_navbar = true %}
{% set show_home_menu = true %}
{% set show_folder_menu = true %}
{% set show_onpage_menu = false %}
{% set show_onpage_icons = false %}
{% set show_site_menu = false %}
{% set show_langswitcher = false %}
{% set show_searchbar = true %}
{% block bottom %}
<script>
$( document ).ready(function() {
autumn.init();
});
</script>
{% endblock %}
{% if collection is null %}
{% set collection = page.collection() %}
{% endif %}
{% set post = collection|length > 0 ? collection|first : ( page.header.content is null ? page : null ) %}
{% if banner_class is null %}
{% set banner_class = '' %}
{% if post %}
{% set banner_class = ' ' ~ ( page.header.banner_class is null ? page.template : page.header.banner_class ) %}
{% endif %}
{% else %}
{% set banner_class = ' ' ~ banner_class %}
{% endif %}
{% block header %}
<header class="banner{{ banner_class }}">
<div class="container 75%">
<div class="content">
{% if ( post and not results_page ) or ( results_page and count > 0 ) %}
{% set heading = heading|defined ? heading : page.header.banner.heading %}
{% if heading %}
<span class="banner-heading">{{ heading }}</span>
{% endif %}
{% set post_title = page.header.banner.title ?: post.title %}
<h1 class="banner-title">{{ post_title }}</h1>
{% set post_author = post.taxonomy.author|first %}
{% set post_translator = post.taxonomy.translator|first %}
<p>{% if post_author %}<i class="fa fa-1x fa-fw fa-user"></i> by <strong><a href="{{ base_url }}/blog/author{{ config.system.param_sep }}{{ post_author|url_encode }}" class="tooltip tooltip-s" aria-label="Posts by {{ post_author }}" rel="tag">{{ post_author }}</a></strong> — {% endif %}{% if post_translator %}<i class="fa fa-1x fa-fw fa-language"></i> by <strong><a href="{{ base_url }}/blog/translator{{ config.system.param_sep }}{{ post_translator|url_encode }}" class="tooltip tooltip-s" aria-label="Posts translated by {{ post_translator }}" rel="tag">{{ post_translator }}</a></strong> — {% endif %}<i class="fa fa-1x fa-fw fa-tag"></i> in {% for tag in post.taxonomy.tag|slice(0,3) %}<a href="{{ base_url }}/blog/tag{{ config.system.param_sep }}{{ tag|url_encode }}" class="tooltip tooltip-s" aria-label="Posts tagged with {{ tag }}" rel="tag">{{ tag }}</a>{%if not loop.last %} + {% endif %}{% endfor %} <i class="fa fa-1x fa-fw fa-calendar-o"></i> <strong><time datetime="{{ post.date | date('Y-m-d H:i:s') }}">{{ post.date | date("d M Y") }}</time></strong></p>
{% if page.header.banner.summary or show_summary %}
<div class="inner">
{{ post.summary | striptags }}
</div>
<div class="container 25%">
<a href="{{ post.url }}" class="button fit icon alt fa-external-link">{{ 'MSG_READ_MORE'|t }}</a>
</div>
{% endif %}
{% else %}
<h1 class="banner-title">Oops!</h1>
{% if results_page %}
<p>{{ heading }}</p>
{% else %}
<p>We are really sorry but the information you requested cannot be found</p>
{% endif %}
<div class="inner">
<i>I know well what I am fleeing from but not what I am in search of</i>... Before you go, try your luck with a random blog post. You might also want to try creating a new post for your request
</div>
<div class="row">
<div class="6u 12u$(small)">
<a href="{{ base_url }}/blog/random" class="button fit icon alt fa-retweet">I'm Feeling Lucky!</a>
</div>
<div class="6u 12u$(small)">
<a href="{{ theme_config.github.tree ~ 'README.md#posts' }}" class="button fit icon alt fa-pencil">Contribute a new post</a>
</div>
</div>
{% endif %}
</div>
</div>
</header>
{% endblock %}
{% block content %}
{% block tabs %}
{% if collection|length > 0 %}
<nav class="blog-tags">
<div class="container">
{% set cats = attribute(page.header.content.items, '@taxonomy.category') %}
{% set tags = taxonomy.taxonomy['tag'] %}
{% set popularTags = {} %}
{% for tag, items in tags %}
{% if taxonomy.findTaxonomy({'category':[cats], 'tag' : tag})|length > 0 %}
{% set popularTags = popularTags|merge([{ 'name' : (tag), 'count' : (items|length) }]) %}
{% endif %}
{% endfor %}
<ul class="nav navbar-nav">
{% for tag in popularTags|sort_by_key('count')|slice(-9)|reverse %}
{% set current_tag = ( uri.params|ends_with('tag'~config.system.param_sep~tag.name) ) ? 'active' : '' %}
<li{% if current_tag %} class="{{ current_tag }}"{% endif %}><a href="{{ page.url|rtrim('/') }}/tag{{ config.system.param_sep }}{{ tag.name|url_encode }}" class="tooltip tooltip-n" aria-label="Posts tagged with {{ tag.name }}" rel="tag">{{ tag.name|upper }}</a></li>
{% endfor %}
</ul>
</div>
</nav>
{% endif %}
{% endblock %}
{% block posts %}
{% if collection|length > 0 %}
<section id="posts" class="wrapper style2">
<main class="autumn-content container" itemscope itemtype="http://schema.org/WebPage">
{# set slice_count = collection|length > 1 ? 1 : 0 #}
{% set slice_count = 0 %}
{% for child in collection|slice(slice_count) %}
{% include 'partials/blog_item.html.twig' with {'blog':page, 'page':child} %}
{% endfor %}
{% if config.plugins.pagination.enabled and collection.params.pagination %}
{% include 'partials/pagination.html.twig' with {'base_url':page.url, 'pagination':collection.params.pagination} %}
{% endif %}
</main>
</section>
{% endif %}
{% endblock %}
{% endblock %}