Is it possible to generate Tag pages by tags/category combination?

Hi all,

First of all my apologies if I fail to properly explain myself, as this is something that I am not quite sure how to properly explain and English isn’t my native language. Please let me know if something needs clarification and/or additional details.

So it happens that currently I am making use of both categories and tags to keep publications to both display them in website’s side bar in their corresponding category, as well to (somewhat) keep them organized.

Based on this, there are some “main” categories (e.g., “review”, “concerts”), that have several tags on them (e.g., “Therion”, “Ayreon”, “Band-Maid”) and a page for each of those tags.

So far it worked well enough as there were not that many articles (and not that many that were shared between different categories), but recently a new category was added (e.g., “interviews”) where some of the already existing tags have been used, meaning that a single tag is now present among 2-3 categories.

The thing is that on the current Tag Page that is created for each tag, I can find all the post for a single tag disregarding the category, but I would like to create a tag page that is only for the entries under certain category. For example, in side bar I have the following:

    - Therion
    - Ayreon
    - Lacrimosa
    - Therion
    - Band-Maid
    - Therion
    - Ayreon

Currently, if we click on Band-Maid (BM) link, it’ll display a tag page that will contain all BM related posts, which it’ll be ok, as post for this tag are all under “concert” category. However, if we click on “Ayreon”, that tag page will show all posts under “review” and “interviews” category, and same case for Therion and it’s 3 categories.

So the main idea/goal would be to, when clicking “Therion” under review, the displayed page would contain only those posts for that tag (Therion) under that category (review) and nothing else. Same case if we click on Therion’s link under “concert”, and “interviews” categories.

I’ve tried to take a look at having multiple categories (as all those fall under a (theoretical) “music” general category), and probably using collections, although I am not quite sure if those would be the appropriate option for this use case (and also I’ve been dense enough to probably misunderstanding how those features work, heh).

I think (based on stuff that I do on .NET) that technically speaking, it should be somewhat possible to get the desired output, but as I am not familiar with how Liquid tags work, as well Ruby, I am not quite sure if this is possible at all.

Any ideas, suggestions, about what to check/learn to be able to do this?

Thanks in advance.

I suppose you could do that - but the concept of a tag is as you are seeing now - all posts that have that tag regardless of the category they are in.

I think you could assign the posts with a certain cat and then loop thru those to see which tags you have?

but this is going to get complex as you add cats and tags as you would need to make a page for each combination and that seems difficult to manage. I’ve not seen anyone try to do something like this but it seems like it could be done but you do have to manually make each page or maybe output it all into one page and then use an anchor to link to the correct section? that maybe the best/simplest way.

Another idea might be to use JS to do this - you could make a json file (using liquid) that gives you all your posts and what tags and cats and then somehow loop thru that on a page? not too sure about that.

Careful with not using posts for this as cats and tags have a special meaning within posts - this gives you site.categories and site.tags. If you use a collection then tags and cats will just be a variable that you could loop thru but they won’t be within the site.tags or cats data.

Maybe you could do something just with the way you have it with JS - if you had an element that said which category that line was for maybe you could find that with JS and delete it if it didn’t match something? again this seems ugly and I am just thinking out loud, this is a terrible idea.

As a user I would probably expect to see all info if I clicked on a tag - regardless of what category.

Though as you have it I only really see categories - like review - and then within that are the items in that cat? or is review a tag?

Hi! My apologies for the late reply.

I really appreciate the insights that you have shared, as well the different possible options that could be used.

Though as you have it I only really see categories - like review - and then within that are the items in that cat? or is review a tag?

You’re correct, review is a category in which a number of tags are contained/assigned. In a practical level, categories are only used (so far) for some for loops as a way to populate, in a sidebar, the available tags in a given category (similar structure, but as an UI, to what I mentioned on my initial post).

As a user I would probably expect to see all info if I clicked on a tag - regardless of what category.

Yeah, you’re also right, that’s the most “natural” approach for this, although we were pondering about how to “fragment” the content of those tags by categories, because we identified a few cases where a single tag page would have a lot of articles, and trying to locate those relevant for a certain category could be a little bit bothersome.

Although… Now that I am thinking, probably/potentially/maybe the segmentation could be done on the tag pages themselves… Something like:


    - ARTICLE 1.1
    - ARTICLE 1.2
    - ARTICLE 1.3

    - ARTICLE 2.1
    - ARTICLE 2.2
    - ARTICLE 2.3

[and so on]

Just playing around the already established categories, some if, for, and similar structures. Something like combining how links on sidebar are created (to get tag/category relationship) and how currently tag files are created (to get post/tags relationship). Yeah, I think that could work.

Also, I know that some folks have created some plugins (rb scripts) to programmatically create files, so that could also be used to generate those files instead manually creating them.

Hey, thanks a lot! I have now something running on my mind, as well a lot of other approaches that could be analyzed (JS, JSON stuff that you mentioned).

Kind regards!