Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

automatically sort posts into upcoming and previous #3

Open
wants to merge 1 commit into
base: gh-pages
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions previous.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,18 @@ title: Previous Topics
Previous Topics
===============


<ul class="listing">
{% assign past_posts = (site.posts | where: "category" , "posts") %}
{% for post in past_posts %}
<li>
<span>{{ post.date | date: "%B %e, %Y" }}</span>
<a href="{{ site.url }}{{ post.url }}">
{{ post.title }} {% if post.author %} &ndash; {{ post.author }} {% endif %}
</a></li>
{% assign curDate = site.time | date: '%s' %}
{% for post in site.posts %}
{% assign postStartDate = post.date | date: '%s' %}
{% if postStartDate < curDate %}
<li>
<span>{{ post.date | date: "%B %e, %Y" }}</span>
<a href="{{ base }}{{ post.url }}">
{{ post.title }} {% if post.author %} &ndash; {{ post.author }} {% endif %}
</a></li>
{% endif %}
{% endfor %}
</ul>

Expand Down
17 changes: 10 additions & 7 deletions upcoming.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,16 @@ charge of that topic to see if they would like to collaborate.


<ul class="listing">
{% assign upcoming = (site.posts | where: "category", "upcoming") %}
{% for post in upcoming reversed %}
<li>
<span>{{ post.date | date: "%B %e, %Y" }}</span>
<a href="{{ site.url }}{{ post.url }}">
{{ post.title }} {% if post.author %} &ndash; {{ post.author }} {% endif %}
</a></li>
{% assign curDate = site.time | date: '%s' %}
{% for post in site.posts reversed %}
{% assign postStartDate = post.date | date: '%s' %}
{% if postStartDate >= curDate %}
<li>
<span>{{ post.date | date: "%B %e, %Y" }}</span>
<a href="{{ base }}{{ post.url }}">
{{ post.title }} {% if post.author %} &ndash; {{ post.author }} {% endif %}
</a></li>
{% endif %}
{% endfor %}
</ul>

Expand Down