Blog-plugin: Combining Categories

Created on 26 Apr 2020  路  6Comments  路  Source: rainlab/blog-plugin

I would like to know if any plans are in the making to further expand this addon, specifically the component Blog List. My issue is that I would like to have two other ways to sort my articles using the this component.

Let's imagine 4 posts, the 3 first posts with 3 different categories, the 4th one would feature all the cateogies at once.

  • The first way would be to be able to pick more than one category and to have EVERY posts with at least one of the chosen categories.

ex: By choosing categories A and B, post #1, #2 and #4 would be displayed.

  • The second one would be to select more than one category but to STRICTLY have the list of posts featuring all these categories at the same time (ex: all the posts having at least categories A AND B attached)

ex: By choosing categories A and B, and choosing the strict option, #4 would be displayed.

Question

All 6 comments

@HitArrowLegend the first scenario, you can already kinda do by using the Posts component and not specifying a category - instead using the "Except categories" option to define the categories you don't want included in the list (although this will also return posts that have no category).

The second scenario, I don't believe there's a way to do that with the currently available components. In this situation, I would suggest making your own custom component based off the Posts component, which you could then adjust the properties and database query to specify multiple categories and search posts which belong to all the specified categories.

@HitArrowLegend the first scenario, you can already kinda do by using the Posts component and not specifying a category - instead using the "Except categories" option to define the categories you don't want included in the list (although this will also return posts that have no category).

It's true that this would work, but how hard would it be to maintain in the long term?
I even thought about attaching a new spatial category to posts that I want to display in a specific widget but again, it defeats the purpose of the idea. What happens when I want to change the design of my blog and I have hundreds of articles with a soon-to-be deleted category?

The second scenario, I don't believe there's a way to do that with the currently available components. In this situation, I would suggest making your own custom component based off the Posts component, which you could then adjust the properties and database query to specify multiple categories and search posts which belong to all the specified categories.

That's why I'm mentionning it there. These two options are what would make Blog close to a god tier addon. It's already insane how versatile it is, but it's unfortunate to not see such features not being supported yet.
Hopefully that will change ^^' (because I lack the skill and knowledge to do it myself :( )

It already is a "god tier addon" 馃槃

It's really not that hard to do it for yourself, two commands and most of the grunt work is taken care of: https://octobercms.com/docs/console/scaffolding#scaffold-create-plugin & https://octobercms.com/docs/console/scaffolding#scaffold-create-component. Then just use the existing component as a reference when building your component and you're pretty much done!

This feature will probably not be added to the base plugin itself unless a lot of people ask for it since it's a pretty specific use case and one that's easily achievable by just extending the base component and changing the logic slightly.

To me, excluding categories is as specific as combining them but I see your point.
Unfortunately, as I mentioned, I don't have the skill to change it myself and have no clue where to find this console. I'll check forum to see if anyone is interested and if no one is, I'll pay someone to do this for me as it will be faster than learning php.

Sounds good, shoot me a message over Slack, Discord, or email if you want me to implement it for you, I'd probably charge $150.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

nycparking picture nycparking  路  7Comments

m49n picture m49n  路  4Comments

marcomessa picture marcomessa  路  7Comments

silasrm picture silasrm  路  4Comments

rodrigogoncalves picture rodrigogoncalves  路  9Comments