Skip to content

Commit

Permalink
Merge pull request #426 from Soroosh/archive
Browse files Browse the repository at this point in the history
Add blog archive page
  • Loading branch information
sylhare committed Feb 2, 2024
2 parents f0614ae + 7f4d821 commit 5cd493e
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 0 deletions.
33 changes: 33 additions & 0 deletions _layouts/archive.liquid
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
layout: page
---

<div class="home">
<div id="archive">
{% assign postsByYear = site.posts | group_by_exp:"post", "post.date | date: '%Y'" %}
<ul class="archive-clouds">
{% for year in postsByYear %}
<a href="#archive-{{ year.name | cgi_escape }}" class="archive-anchor">
<li>
{{ year.name | cgi_escape }} ({{year.items.size}})
</li>
</a>
{% endfor %}
</ul>
{% for year in postsByYear %}
<div class="archive-group">
<h4 id="archive-{{year.name}}" class="title">{{ year.name }} ({{year.items.size}})</h4>
<div class="items">
{% for post in year.items %}
<a href="{{ post.url | relative_url }}" class="archive-post-link">
<div class="item">
<p class="meta">{{ post.date | date: site.data.language.str_date_format | default: '%B %-d, %Y' }}</p>
<p class="title">{{ post.title }}</p>
</div>
</a>
{% endfor %}
</div>
</div>
{% endfor %}
</div>
</div>
5 changes: 5 additions & 0 deletions _sass/layouts/_categories.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#archive,
#categories {
.archive-clouds,
.category-clouds {
margin: 30px 0 30px;

Expand Down Expand Up @@ -30,12 +32,14 @@
color: var(--header-text);
}

.archive-anchor:hover,
.category-anchor:hover {
text-decoration: none !important;
filter: none;
}
}

.archive-group,
.category-group {
padding: 15px 0 10px;

Expand Down Expand Up @@ -71,6 +75,7 @@
height: 100%;
}

.archive-post-link:hover,
.category-post-link:hover {
text-decoration: none;

Expand Down
9 changes: 9 additions & 0 deletions pages/archive.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
layout: archive
title: "Blog Archive"
permalink: /archive/
hide: true
excluded: true
icon: "fa-archive"
position: 6
---

0 comments on commit 5cd493e

Please sign in to comment.