-
-
Save MattSLangford/9cbc0bda4d87c4d9fff5e2865c032b2f to your computer and use it in GitHub Desktop.
Categories in Marfa
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
// STEP ONE: Create a template file called layouts/partials/post-categories.html with the following code: | |
{{ if .Params.categories }} | |
<section class="post-categories"> | |
<p>{{ range sort .Params.categories }}<a href="{{ "/categories/" }}{{ . | urlize }}">{{ . }}</a> {{ end }}</p> | |
</section> | |
{{ end }} | |
// STEP TWO: Line to insert on posts and home page: | |
{{ partial "post-categories.html" . }} | |
// Refer to this post for more in depth instructions, including how to style: https://www.mattlangford.net/2020/01/14/adding-categories-to.html |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment