UNPKG

4.6 kBHTMLView Raw
1{% extends "layout.html" %}
2{% include "blogMacros.html" %}
3
4{% block bodyClass %}{{ super() }} apos-blog-page{% endblock %}
5
6{# 'here()' returns the URL of the page, with the year and month added if we are #}
7{# viewing by month, plus any query string based on active filters. You can pass #}
8{# 'changes' to override filters. Passing null for a filter removes it. #}
9
10{%- macro here(changes) -%}
11 {{ page.url | build([ 'year', 'month' ], { year: activeYear, month: activeMonth, search: query.search }, changes) }}
12{%- endmacro -%}
13
14{# Output the current content of the page, with buttons to edit it #}
15
16{% block mainContent %}
17
18 <div class="blog-filter clearfix">
19
20 {# View by Month or View Recent #}
21 {% if defaultView %}
22 <div class="filter-element view-by-month-button"><h4><a href="{{ here({ year: thisYear, month: thisMonth }) }}">{{ __('View Articles by Month') }}</a></h4></div>
23 {% else %}
24 <div class="filter-element view-recent-button"><h4><a href="{{ here({ year: '', month: '' }) }}">{{ __('View Recent Articles') }}</a></h4></div>
25 {% endif %}
26
27 {# Title of current view (shows month forward and backward controls in month view) #}
28 {% if defaultView %}
29 <div class="filter-element active-view"><h4>{{ __('Recent Articles') }}</h4></div>
30 {% else %}
31 <div class="filter-element current-month">
32 <h4 class="month browse-by-month active">
33 <a class="month-previous" href="{{ here({ year: prevYear, month: prevMonth }) }}">&laquo;</a>
34 <span class="month current">{{ (activeYear + '-' + activeMonth + '-01') | date('MMMM YYYY') }}</span>
35 <a class="month-next" href="{{ here({ year: nextYear, month: nextMonth }) }}">&raquo;</a>
36 </h4>
37 </div>
38 {% endif %}
39
40 </div>
41
42 <div class="column">
43
44 {% if page.children.length %}
45 <div class="column-element">
46
47 {% block subnav %}
48 <div class="subnavigation">
49 <h4>{{ __('Subpages') }}</h4>
50 <ol class="children">
51 {% for relative in page.children %}
52 <li><a href="{{ relative.url }}">{{ relative.title | e }}</a></li>
53 {% endfor %}
54 </ol>
55 </div>
56 {% endblock %}
57
58 </div>
59 {% endif %}
60
61 {% set filteredFeed = here({ 'feed': 'rss' }) %}
62 {% set fullFeed = page.url | build({ 'feed': 'rss' }) %}
63
64 <div class="column-element filter-links">
65
66 {# RSS auto discovery #}
67 {% block extraHead %}
68 <link rel="alternate" type="application/rss+xml" title="{{ page.title | e }}" href="{{ filteredFeed or fullFeed }}" />
69 {% endblock %}
70
71 {% if filteredFeed != fullFeed %}
72 <h4><a href="{{ filteredFeed }}"><img src="/modules/snippets/images/feed-icon-16x16.png" /> {{ __('Filtered RSS Feed') }}</a></h4>
73 {% endif %}
74 <h4><a href="{{ fullFeed }}"><img src="/modules/snippets/images/feed-icon-16x16.png" /> {{ __('Full RSS Feed') }}</a></h4>
75 </div>
76
77 <div class="column-element apos-area-sidebar">
78 {{ aposArea(
79 page,
80 'sidebar',
81 {
82 controls: ['style', 'bold', 'italic', 'createLink' ],
83 styles: [ { value:'div', label: 'Normal' }, { value: 'h4', label: 'Heading' } ]
84 }
85 ) }}
86 </div>
87
88 </div>
89
90 <div class="column-2">
91 {# Search filter markup borrowed from Stuart, TODO: ask him about #}
92 {# suitable styles from a related project #}
93 <form class="apos-search-form filter-search{% if query.search %} searched{% endif %}" method="GET" action="">
94 <div class="search-title">{{ __('Search For') }}:</div>
95 <div class="search-inputs">
96 <input name="search" value="{{ query.search | e }}" class="search-field" />
97 <input type="submit" class="search-submit" value="{{ __('search') }}" />
98 {% if query.search %}
99 <a class="search-clear" href="{{ here({ search: '' }) }}">X</a>
100 {% endif %}
101 </div>
102 </form>
103 <div class="apos-blog-posts">
104 {{ renderBlogPostPreviews(pieces, page.url) }}
105 </div>
106 {{ renderPager(pager, here({})) }}
107 </div>
108
109
110 {# Just uncomment this script block to enable infinite scroll instead! #}
111
112 {#
113 <script type="text/javascript">
114 $(function() {
115 $('.apos-refreshable .apos-blog-posts').bottomless({
116 url: {{ page.url | json }}
117 });
118 // We don't need the pager if we can infinite scroll
119 // However we hide it with JavaScript so that
120 // Google still finds it otherwise we have serious SEO issues!
121 $('.apos-refreshable .apos-pager').hide();
122 });
123 </script>
124 #}
125
126{% endblock %}