Sorry, we don't support your browser.  Install a modern browser

$pages->groupBy(): $split parameter#142

A split parameter to the $pages->groupBy() method would be helpful for grouping items with multiple tags.

Consider:

Title: Banana
----
Tags: fruit, yellow
Title: Strawberry
----
Tags: fruit, red
Title: Radish
----
Tags: vegetable, red

If a groupBy() could split parameters, it could output a grouping such as this:

$pages->groupBy('tags', true, ',')

[
  'fruit' => [Banana, Strawberry],
  'yellow' => [Banana],
  'red' => [Strawberry, Radish],
  'vegetable' => [Radish]
]
4 days ago

Although I see its usefulness; I think we should aim for a “real” taxonomy implementation.

3 days ago

@Bart Vandeputte how would a “real” implementation look like?

2 days ago

As I see this, most taxonomy implementations are a centralized view of managing vocabularies with terms associated to them. The closest thing that resembles this in Kirby is the tags-field; but it lacks the option to manage (CRUD) the tags in a centralized place. We also have no built in helpers to e.g. keep tags consistent over translations; filter based on it, … Maybe it “can be done”, but I have yet to see a nice implementation for it that doesn’t go up in a spaghetti of hooks and helpers that quickly grow beyond control ;-)

I wrote a bit more about this here: https://www.notion.so/mnfrm/Kirby-taxonomy-a60c2446f9c1402e8ac50cc0c9051694

Discussion is encouraged as this is not a trivial thing imho.

2 days ago

PS: I don’t want to hijack your post. Should I create a new one?

2 days ago

@Bart Vandeputte Ok yes, I think that would be a separate thing on its own :)

2 days ago