Skip to content

Commit

Permalink
Merge pull request getpelican#533 from josch/archive-sidebar
Browse files Browse the repository at this point in the history
pelican-bootstrap3: Add archive to sidebar
  • Loading branch information
justinmayer authored Sep 4, 2017
2 parents dcecbb6 + e315b00 commit 65acef2
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
1 change: 1 addition & 0 deletions pelican-bootstrap3/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ icon to show. You can provide an alternative icon string as the third string (as
* **Categories** will be shown if `DISPLAY_CATEGORIES_ON_SIDEBAR` is set to _True_
* **Recent Posts** will be shown if `DISPLAY_RECENT_POSTS_ON_SIDEBAR` is set to _True_
* Use `RECENT_POST_COUNT` to control the amount of recent posts. Defaults to **5**
* **Archive** will be shown if `DISPLAY_ARCHIVE_ON_SIDEBAR` is set to _True_ and `MONTH_ARCHIVE_SAVE_AS` is set up properly.
* **Authors** will be shown if `DISPLAY_AUTHORS_ON_SIDEBAR` is set to _True_

Other sidebar related options include:
Expand Down
1 change: 1 addition & 0 deletions pelican-bootstrap3/templates/includes/sidebar.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
{% include 'includes/sidebar/links.html' %}
{% include 'includes/sidebar/authors.html' %}
{% include 'includes/sidebar/images.html' %}
{% include 'includes/sidebar/archive.html' %}
{% include 'includes/sidebar/optional_bottom.html' ignore missing %}
</ul>
</section>
Expand Down
23 changes: 23 additions & 0 deletions pelican-bootstrap3/templates/includes/sidebar/archive.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{% if DISPLAY_ARCHIVE_ON_SIDEBAR and MONTH_ARCHIVE_SAVE_AS %}
{% from 'includes/sidebar/macros.jinja' import title %}

<!-- Sidebar/Archive -->
<li class="list-group-item">
<h4>{{ title(_('Archive'), DISABLE_SIDEBAR_TITLE_ICONS) }}</h4>
<ul class="list-group" id="archive">
{% for year, date_year in dates|groupby( 'date.year' )|sort(reverse=True) %}
{% for month, articles in date_year|groupby( 'date.month' )|sort(reverse=True) %}
<li class="list-group-item">
<a href="{{ SITEURL }}/{{ MONTH_ARCHIVE_SAVE_AS.format(date=articles[0].date) }}">
{%- if not DISABLE_SIDEBAR_TITLE_ICONS -%}
<i class="fa fa-calendar fa-lg"></i>
{%- endif -%}
{{ articles[0].date.strftime('%B') }} {{ year }} ({{ articles|count }})
</a>
</li>
{% endfor %}
{% endfor %}
</ul>
</li>
<!-- End Sidebar/Archive -->
{% endif %}

0 comments on commit 65acef2

Please sign in to comment.