Skip to content

Commit

Permalink
Archive posts (#9)
Browse files Browse the repository at this point in the history
* Adding archive.html & link to page via footer.

* Rename projects.md to .html for consistency

* Adding collections to _config.yml

* Move _posts & _archived_posts under collections/

* Adding archive.html & link in footer.

* Updating archive.html layout, archiving posts.

* Reverse chronological order for archived posts

* Reusing archive.html post ordering in blog.html

* Adding title attribute to Archive footer link

Co-authored-by: tomaskul <>
  • Loading branch information
tomaskul authored Jun 19, 2022
1 parent e6f526b commit f0a9875
Show file tree
Hide file tree
Showing 36 changed files with 54 additions and 14 deletions.
5 changes: 5 additions & 0 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ extensions:
source : ./
destination : ./_site

collections_dir: collections
collections:
archived_posts:
output: true

# Sass configuration
sass:
sass_dir : assets/scss
Expand Down
4 changes: 3 additions & 1 deletion _includes/footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
<i class="fa fa-copyright"></i> {{ site.time | date: '%Y' }} {{ site.author.name }} |
<b>Find me on:</b> <a href="https://twitter.com/tomas__tweets">Twitter</a> |
<a href="https://www.linkedin.com/in/tomas-kulvietis/">LinkedIn</a> |
<a href="https://github.com/tomaskul">GitHub</a>
<a href="https://github.com/tomaskul">GitHub</a> |
<a href="{{ '/archive' | prepend: site.baseurl }}"
title="Collection of archived blog posts.">Archive</a>
</small>
</div>
</footer>
32 changes: 32 additions & 0 deletions archive.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
layout: default
title: Archive
subheading: Collection of archived blog posts.
---

<article class="page container">
<header class="page-header">
<h1 class="page-title">{{ page.title }}</h1>
</header>
<div class="page-content">
<p>{{ page.subheading }}</p>
</div>
</article>

<section class="post-list">
<div class="container">
{% assign postsByYear =
site.archived_posts | group_by_exp:"post", "post.date | date: '%Y'" %}
{% for year in postsByYear reversed %}
<h2 class="category-title">{{ year.name }}</h2>
{% for post in year.items reversed %}
<article class="post-item">
<span class="post-meta date-label">{{ post.date | date: "%b %d" }}</span>
<div class="article-title">
<a class="post-link" href="{{ post.url | prepend: site.baseurl }}">{{ post.title }}</a>
</div>
</article>
{% endfor %}
{% endfor %}
</div>
</section>
27 changes: 14 additions & 13 deletions blog.html
Original file line number Diff line number Diff line change
@@ -1,31 +1,32 @@
---
layout: default
title: Blog
subheading: Couple of posts I've written... Enjoy!
---

<article class="page container">
<header class="page-header">
<h1 class="page-title">{{ page.title }}</h1>
</header>
<div class="page-content">
<p>Couple of posts I've written... Enjoy!</p>
<p>{{ page.subheading }}</p>
</div>
</article>

<section class="post-list">
<div class="container">
{% for post in site.posts %} {% unless post.next %}
<h2 class="category-title">{{ post.date | date: '%Y' }}</h2>
{% else %} {% capture year %}{{ post.date | date: '%Y' }}{% endcapture %} {% capture nyear %}{{ post.next.date | date: '%Y'
}}{% endcapture %} {% if year != nyear %}
<h2 class="category-title">{{ post.date | date: '%Y' }}</h2>
{% endif %} {% endunless %}
<article class="post-item">
<span class="post-meta date-label">{{ post.date | date: "%b %d" }}</span>
<div class="article-title">
<a class="post-link" href="{{ post.url | prepend: site.baseurl }}">{{ post.title }}</a>
</div>
</article>
{% assign postsByYear =
site.posts | group_by_exp:"post", "post.date | date: '%Y'" %}
{% for year in postsByYear %}
<h2 class="category-title">{{ year.name }}</h2>
{% for post in year.items %}
<article class="post-item">
<span class="post-meta date-label">{{ post.date | date: "%b %d" }}</span>
<div class="article-title">
<a class="post-link" href="{{ post.url | prepend: site.baseurl }}">{{ post.title }}</a>
</div>
</article>
{% endfor %}
{% endfor %}
</div>
</section>
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit f0a9875

Please sign in to comment.