-
Notifications
You must be signed in to change notification settings - Fork 182
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- makes it easier for someone to setup a post category index as they’ll just need to create make a page and specify the front matter
- Loading branch information
1 parent
caae950
commit c37680a
Showing
2 changed files
with
33 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
--- | ||
layout: page | ||
--- | ||
|
||
{% if page.category_name %} | ||
{% assign category_name = page.category_name %} | ||
{% endif %} | ||
|
||
{% for post in site.categories[category_name] %} | ||
<div class="container mx-auto py-2 mb-2 prose"> | ||
<a class="no-underline h5 bold text-accent" title="{{ post.url | prepend: site.baseurl }}" href="{{ post.url | prepend: site.baseurl }}">{{ post.date | date: "%b %-d, %Y" }}</a> | ||
<h2 class="h1 lh-condensed mt-0"> | ||
<a class="link-primary" title="{{ post.url | prepend: site.baseurl }}" href="{{ post.url | prepend: site.baseurl }}">{{ post.title }}</a> | ||
</h2> | ||
<p>{{ post.content | strip_html | truncatewords:30 }}</p> | ||
</div> | ||
{% endfor %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,21 @@ | ||
--- | ||
layout: page | ||
layout: category_index | ||
title: Writing | ||
permalink: /writing/ | ||
category_name: writing | ||
--- | ||
|
||
<!-- Choose which category you want to show posts for. --> | ||
{% for post in site.categories.writing %} | ||
<div class="container mx-auto py-2 mb-2 prose"> | ||
<a class="no-underline h5 bold text-accent" title="{{ post.url | prepend: site.baseurl }}" href="{{ post.url | prepend: site.baseurl }}">{{ post.date | date: "%b %-d, %Y" }}</a> | ||
<h2 class="h1 lh-condensed mt-0"> | ||
<a class="link-primary" title="{{ post.url | prepend: site.baseurl }}" href="{{ post.url | prepend: site.baseurl }}">{{ post.title }}</a> | ||
</h2> | ||
<p>{{ post.content | strip_html | truncatewords:30}}</p> | ||
</div> | ||
{% endfor %} | ||
<!-- | ||
Set the front matter: | ||
title = your page title and link name in the navigation | ||
permalink = the url for the page, i.e. example.com/my-awesome-category | ||
category_name = the name of the cateogry you want to use to group posts, you'll need to use the same name on post pages | ||
Save this page in the root directory. | ||
Use the same name for the filename as the permalink, i.e. | ||
permalink: /my-awesome-category/ | ||
filename: my-awesome-category.html | ||
--> |