Per-section content filter using taxonomy

Hello,

I’m trying to implement per-section content filter as in the following scenario.

Topmost sections of the site are as follows:

  • Docs
  • Blog
  • Others

In Blog, there will be several types of posts, e.g. Article, Video, and News.
There will be buttons for each type, and when you press a button, only the corresponding posts should be displayed.

In this case, can I use Hugo taxonomy in order to implement content filtering under Blog section only?

We prefer to do it Hugo way instead of using many CSS and JS codes.

Thank you.

Yep, you can do this using the built-in categories https://gohugo.io/content-management/taxonomies/#default-taxonomies

1 Like

I am not sure if this site: https://scripter.co/ shows what you want.

1 Like

@funkydan2, @Bin951:
Thank you for the answers.

I have a couple of follow-up questions.

  1. Then, can I make the taxonomy url under specific section like below?
    https://baseURL/section/taxonomy/term

  2. Can I also use the taxonomy for filtering by post date?

I think (1) is default. If you look at the site @Bin951 linked to - https://scripter.co/categories/programming/ is how categories (a default taxonomy) is linked. I’m not sure what you need to do to make the url //scripture.co/blog/categories/programming - maybe you can change the SLUG in your configuration??

And I’m not sure what you mean by (2). Are you asking whether you can filter by date in the list.html for a category? I.e. only list posts from 2018 in the Video category?

For (1), I found a clue from the following and could achieve a similar effect by defining the taxonomy with “[section-name]/taxonomy”

(2) means using date param as a taxonomy and specific date value as terms, but I found out that date (as well as other built-in params) is not supposed to be used as such by definition. Is this correct?