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

About tags #8

Open
GhostBasenji opened this issue Aug 29, 2019 · 4 comments
Open

About tags #8

GhostBasenji opened this issue Aug 29, 2019 · 4 comments

Comments

@GhostBasenji
Copy link

There are tags? And they will work (i.e. click to select articles according to labels)?

@GhostBasenji GhostBasenji changed the title Abot tags About tags Aug 30, 2019
@skoruba
Copy link

skoruba commented Apr 4, 2020

Is it possible to add support for filtering posts using tags?
Thanks

@DotIN13
Copy link
Contributor

DotIN13 commented Apr 4, 2020

Is it possible to add support for filtering posts using tags?
Thanks

If you want to paginate your posts by tags, you could check Jekyll plugin paginate v2. You should be able to easily filter posts with it.

If not, you can always use liquid like this:

{% for post in site.posts %}
{% if post.tags contains "yourfilter" %}
Your post
{% endif %}
{% endfor %}

@Krinkle
Copy link
Contributor

Krinkle commented Apr 4, 2020

I'm using this theme as well, and ended up creating my own minimal way to do tags.

I looked at several themes and plugins for Jekyll, but most do this client-side which I think delivers an unacceptable user-experience, often without a permalink to "posts with tag X" as it relied on clicking buttons.

The way I do it is to create an empty placeholder page for each of the tags I want to use, which then gets generated by Jekyll into the list of posts. For most themes, this tag page layout would be similar to your home page, except iterating for post in site.tags[page.tag] instead of or post in site.posts. Note that site.tags[] is a Jekyll built-in – it works by default! (no custom filter logic needed).

Source code: github.com/Krinkle/timotijhof.net

- _posts/
   - 2020-04-04-example.md
   -  
- _layouts/
   - tag.html
- tags/
   - some.md
   - tags.md
   - here.md

posts/2020-04-04-example.md:

---
layout: post
title: "Example"
tags: some here
---
Content here. …

tags/some.md:

---
layout: tag
title: Something
tag: some
---

Example: https://timotijhof.net/tags/wikipedia/.

@skoruba
Copy link

skoruba commented Apr 4, 2020

@Krinkle - thanks for sharing your work, I will use your version, I really like your improvements.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants