How to show blog categories using the taxonomylist plugin?

I’m new to GRAV and like it very much (a big thank you to the GRAV team!), but I have problems to understand the taxonomy and collections mechanism fully even after reading the docs several times and fiddling with the templates for days now.

I’ve set up my site using the antimatter default theme and did customize it to my needs. The site features a list of products with several categories such as “routers”, “switches”, “supplies” etc. In product pages I use the taxonomy category for those categories (“routers”, “switches” etc.) and the subcategory products for different items in the same main category.

Now I want to add a blog and did set up pages under the folder /blog with the category blog set in those pages as suggested in the examples. The list of related blog posts is generated using the taxonomylist plugin with taxonomy tags.

Now I want to further classify blog posts into different categories, but if I use:

{% include 'partials/taxonomylist.html.twig' with {'base_url':new_base_url, 'taxonomy':'category'} %}

to collect the subcategories of the blog, it shows me any categories used elsewhere.

How can I restrict collections of categories to the blog folder only? Should I have used another taxonomy instead of category for product pages (for example: class or something)? I think, I just don’t understand the concept of category vs. tags fully or how to restrict taxonomy lists to a part of the site only. Although the plugin lists tags/categories from elsewhere, it only creates links to the /blog route as defined in the yaml file, which is very confusing to me - why does the plugin not restrict taxonomy lists to this route, too, but collects taxonomies of pages from the whole website?

Please, can someone suggest a way how to structure product categories apart from blog categories?

Thanks in advance!

I know by experience it can be hard to understand taxonomy, it is actually quite a huge subject with unlimited ways to define a way how it can work. But, taxonomy can also be a dream if set up correctly for your situation.
Explained by Wikipedia taxonomy is:

Taxonomy is the practice and science of classification. The word is also used as a count noun: a taxonomy, or taxonomic scheme, is a particular classification.

Which basically means to group any kind of idea or an object into classes, sub-classes and so on, which is called to categorize. Then the items in a category can share characteristics, and that can be anything from language and origin to size and color, and in Grav these are called tags, but it can be called basically anything.

Having the possibility to group items that do the same thing but different, or have the same background but in different regions and then be able to connect these things with each other to see the difference or find a solution to a problem that maybe is not only one problem is the possibilities of taxonomy, and Grav have that possibility!

I would suggest in your situation to add every product to the category: Products and then give each product a tag of the type of product. Every blog post should be in the category blog and each blog post that is about some of the products should have tags that connect to the products.

Just add this to every product and blog post:

taxonomy:
    category: blog or product
    tag: [product type1, product type2]

But as I have experienced my self, nothing is better than doing your self. Finding your own solution and way is the best way to move forward.

Good luck forward and happy Graving!

1 Like

Thanks for your reply!

It did shed some light on the topic. So if I understand correctly, category and tag taxonomies are just kind of an arbitrary classification equally weighted, but not hierarchically related as in category -> subcategory and not even related to the location of the files?

So, for blog posts being separated from other category classes such as product items (e.g. category: switches) I probably should use another taxonomy term such as interest or whatever instead of the term category (e.g. interest: community for community-related blog posts and interest: networking for networking stuff)?

Exactly! It is up to you what you call “category” and “tag”, those names are just a general explanation of how to organize your custom content. If your site is big you can have several “categories” like products, blogs and so on. And then under products, you can have categories like networking, computers, programs…

And then you have “tags” which you also can divide if you feel like you need extensive organization because your site is big. But as I said, “tags” is just a way to connect the items in “categories” when they have something in common. So tags do not need to have anything in common with each other to make sense since they can basically just give an indication of color, size and so on.

1 Like

I see. Very powerful concept indeed, thanks for your explanation, procrates! Lots of ideas come to my mind … :smiley:

Yes! Very powerful! But with great power there comes great complications! In this case for your self and your users, so the trick is to make it as simple as possible, but eternally extensible.

1 Like

Fully agreed! I like small & simple designs, they are most flexible as KISS design has teached us. So, if tags are just another kind of category, I’ll keep the default blog main category for now and just use tags to incorporate the different areas of interest to readers.

Thanks again for your kind help, much appreciated.

1 Like