Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hierarchical tag support #5481

Open
1 task done
DoctorRetromaker opened this issue Feb 10, 2025 · 3 comments
Open
1 task done

Hierarchical tag support #5481

DoctorRetromaker opened this issue Feb 10, 2025 · 3 comments

Comments

@DoctorRetromaker
Copy link

Describe the feature you'd like

As books are structured in a real hierarchy -«books» -> «chapters» -> «pages»-, in order to go deeper with «tag hacking», I suggest to respect the tags inheritance up to down.

Used in this way, the «global tag hacking» should be made at «book» level -tags set in the book attributes should be added to the section of every «chapter»-

Tags set for each «chapter» should be inherited for every «page», along with the global «book» and the specific «page» ones.

Describe the benefits this would bring to existing BookStack users

Customization could be easier setting «tag hacking» in a hierarchical way, so for a global hack, the user only needs to ad a tag at «book» level, instead of repeat the tag for each page.

Same when the hacking is only need to be applied al «chapter» level.

Currently, "tags" are stored as a "per entity" attribute, so there is no one-to-many relationship between tags; it might be a good time to change this management and establish a real one-to-many relationship between "tags" and "entities".

Can the goal of this request already be achieved via other means?

I don't think so

Have you searched for an existing open/closed issue?

  • I have searched for existing issues and none cover my fundamental request

How long have you been using BookStack?

3 months to 1 year

Additional context

The main drawback is setting up a method for inheritance:

  1. The easy way is to copy all the tags from the "parent" object when any item is created; this could affect the result for which the tags were originally intended: tagged searches
  2. After checking DB content, pages are stored without , nor sections, so these must be added at «rendering time»; depending on how the tag search algorithm has been implemented, adding the legacy tags within the rendering process avoids any collision between both mechanisms, search and hacking
@Hallsie
Copy link

Hallsie commented Feb 14, 2025

Question: Are the tags "hard coded" meaning you cannot change them?

For example if we are in the shelf: Woodworking Book: Cabinets Chapter: Doors and let's just say those are also tags then when I create a page in the Doors chapter it will have Woodworking, Cabinets, Doors tags and obviously I can add more. Are you suggesting that those would be hard coded in there? Let's say for example I have a page that I want to put in there that is about Hinges and I want to use an include {{@65}} for that page. Can I remove the tags because it doesn't really go or are they stuck because inheritance would force them?

Another example would be temporary tags that I use to remind myself of things I wish to do like in a chapter I may have a tag that says "add pictures" to let me know that I need to come back and add pictures to this chapter but the page I am moving into the chapter may not need that and I don't want it.

@DoctorRetromaker
Copy link
Author

DoctorRetromaker commented Feb 15, 2025

Yes, one implementation option is to inherit all father tags ... other approach is to use a hardcoded syntax similar to "hack-......." and only inherit these kind of tags, despite this last option sounds excessively tricky and unclear for user ... I think the main problem at the implementation level will be how to handle hierarchical changes, that is, how to transfer a change at the parent level to children and grandchildren.

I think tags inheritance is a help to do «tags hacks», for example, when a global hack would force to add those «hacking-tags» on each page along the book by hand ..

Regarding your example, there is no option to "add pictures" at chapter or book level, so this kind of tags are page level ... isn't?

To avoid "hack-tags" showed in "tags-search", I'm, using a CSS "display:none" applied to classes starting "tag-name-hack....."

@Hallsie
Copy link

Hallsie commented Feb 17, 2025

Regarding your example, there is no option to "add pictures" at chapter or book level, so this kind of tags are page level ... isn't?

There is an option for "Book Tags" as well as "Chapter Tags" but generally I tag the pages and not book/chapter. If I were doing an import though of something then I may want to use that if say pictures were not coming in via copy/paste etc. Even then I could still just do it on each page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants