aboutsummaryrefslogtreecommitdiffstats
path: root/pelican-bootstrap3
diff options
context:
space:
mode:
authorJohannes 'josch' Schauer <josch@mister-muffin.de>2017-07-30 17:18:02 +0200
committerJohannes 'josch' Schauer <josch@mister-muffin.de>2017-07-30 17:18:02 +0200
commitacddee8948a8e772394911a081d029ff07ea056a (patch)
tree9a5e63eff49f4895cb764b4c57c970522d987798 /pelican-bootstrap3
parent2a00d3cbf6ed7745ae3cd2f6a557bad31d4a3990 (diff)
downloadpelican-themes-acddee8948a8e772394911a081d029ff07ea056a.tar.gz
pelican-bootstrap3: Add archive to sidebar
Diffstat (limited to 'pelican-bootstrap3')
-rw-r--r--pelican-bootstrap3/README.md1
-rw-r--r--pelican-bootstrap3/templates/includes/sidebar.html1
-rw-r--r--pelican-bootstrap3/templates/includes/sidebar/archive.html23
3 files changed, 25 insertions, 0 deletions
diff --git a/pelican-bootstrap3/README.md b/pelican-bootstrap3/README.md
index 02a130a..1c210c5 100644
--- a/pelican-bootstrap3/README.md
+++ b/pelican-bootstrap3/README.md
@@ -251,6 +251,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.
Other sidebar related options include:
diff --git a/pelican-bootstrap3/templates/includes/sidebar.html b/pelican-bootstrap3/templates/includes/sidebar.html
index 7772ff8..b9cd101 100644
--- a/pelican-bootstrap3/templates/includes/sidebar.html
+++ b/pelican-bootstrap3/templates/includes/sidebar.html
@@ -11,6 +11,7 @@
{% include 'includes/sidebar/twitter_timeline.html' %}
{% include 'includes/sidebar/links.html' %}
{% include 'includes/sidebar/images.html' %}
+ {% include 'includes/sidebar/archive.html' %}
{% include 'includes/sidebar/optional_bottom.html' ignore missing %}
</ul>
</section>
diff --git a/pelican-bootstrap3/templates/includes/sidebar/archive.html b/pelican-bootstrap3/templates/includes/sidebar/archive.html
new file mode 100644
index 0000000..881897b
--- /dev/null
+++ b/pelican-bootstrap3/templates/includes/sidebar/archive.html
@@ -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 %}