mirror of
https://github.com/BookStackApp/BookStack.git
synced 2026-02-05 00:29:48 +03:00
[Feature request]Automatic update of cross-linking between pages/chapters/books #1598
Closed
opened 2026-02-05 01:22:13 +03:00 by OVERLORD
·
8 comments
No Branch/Tag Specified
development
l10n_development
further_theme_development
release
llm_only
vectors
v25-11
docker_env
drawio_rendering
user_permissions
ldap_host_failover
svg_image
prosemirror
captcha_example
fix/video-export
v25.12.3
v25.12.2
v25.12.1
v25.12
v25.11.6
v25.11.5
v25.11.4
v24.11.4
v25.11.3
v25.11.2
v25.11.1
v25.11
v25.07.3
v25.07.2
v25.07.1
v25.07
v25.05.2
v25.05.1
v25.05
v25.02.5
v25.02.4
v25.02.3
v25.02.2
v25.02.1
v25.02
v24.12.1
v24.12
v24.10.3
v24.10.2
v24.10.1
v24.10
v24.05.4
v24.05.3
v24.05.2
v24.05.1
v24.05
v24.02.3
v24.02.2
v24.02.1
v24.02
v23.12.3
v23.12.2
v23.12.1
v23.12
v23.10.4
v23.10.3
v23.10.2
v23.10.1
v23.10
v23.08.3
v23.08.2
v23.08.1
v23.08
v23.06.2
v23.06.1
v23.06
v23.05.2
v23.05.1
v23.05
v23.02.3
v23.02.2
v23.02.1
v23.02
v23.01.1
v23.01
v22.11.1
v22.11
v22.10.2
v22.10.1
v22.10
v22.09.1
v22.09
v22.07.3
v22.07.2
v22.07.1
v22.07
v22.06.2
v22.06.1
v22.06
v22.04.2
v22.04.1
v22.04
v22.03.1
v22.03
v22.02.3
v22.02.2
v22.02.1
v22.02
v21.12.5
v21.12.4
v21.12.3
v21.12.2
v21.12.1
v21.12
v21.11.3
v21.11.2
v21.11.1
v21.11
v21.10.3
v21.10.2
v21.10.1
v21.10
v21.08.6
v21.08.5
v21.08.4
v21.08.3
v21.08.2
v21.08.1
v21.08
v21.05.4
v21.05.3
v21.05.2
v21.05.1
v21.05
v21.04.6
v21.04.5
v21.04.4
v21.04.3
v21.04.2
v21.04.1
v21.04
v0.31.8
v0.31.7
v0.31.6
v0.31.5
v0.31.4
v0.31.3
v0.31.2
v0.31.1
v0.31.0
v0.30.7
v0.30.6
v0.30.5
v0.30.4
v0.30.3
v0.30.2
v0.30.1
v0.30.0
v0.29.3
v0.29.2
v0.29.1
v0.29.0
v0.28.3
v0.28.2
v0.28.1
v0.28.0
v0.27.5
v0.27.4
v0.27.3
v0.27.2
v0.27.1
v0.27
v0.26.4
v0.26.3
v0.26.2
v0.26.1
v0.26.0
v0.25.5
v0.25.4
v0.25.3
v0.25.2
v0.25.1
v0.25.0
v0.24.3
v0.24.2
v0.24.1
v0.24.0
v0.23.2
v0.23.1
v0.23.0
v0.22.0
v0.21.0
v0.20.3
v0.20.2
v0.20.1
v0.20.0
v0.19.0
v0.18.5
v0.18.4
v0.18.3
v0.18.2
v0.18.1
v0.18.0
v0.17.4
v0.17.3
v0.17.2
v0.17.1
v0.17.0
v0.16.3
v0.16.2
v0.16.1
v0.16.0
v0.15.3
v0.15.2
v0.15.1
v0.15.0
v0.14.3
v0.14.2
v0.14.1
v0.14.0
v0.13.1
v0.13.0
v0.12.2
v0.12.1
v0.12.0
v0.11.2
v0.11.1
v0.11.0
v0.10.0
v0.9.3
v0.9.2
v0.9.1
v0.9.0
v0.8.2
v0.8.1
v0.8.0
v0.7.6
v0.7.5
v0.7.4
v0.7.3
0.7.2
v.0.7.1
v0.7.0
v0.6.3
v0.6.2
v0.6.1
v0.6.0
v0.5.0
Labels
Clear labels
🎨 Design
📖 Docs Update
🐛 Bug
🐛 Bug
:cat2:🐈 Possible duplicate
💿 Database
☕ Open to discussion
💻 Front-End
🐕 Support
🚪 Authentication
🌍 Translations
🔌 API Task
🏭 Back-End
⛲ Upstream
🔨 Feature Request
🛠️ Enhancement
🛠️ Enhancement
🛠️ Enhancement
❤️ Happy feedback
🔒 Security
🔍 Pending Validation
💆 UX
📝 WYSIWYG Editor
🌔 Out of scope
🔩 API Request
:octocat: Admin/Meta
🖌️ View Customization
❓ Question
🚀 Priority
🛡️ Blocked
🚚 Export System
♿ A11y
🔧 Maintenance
> Markdown Editor
Milestone
No items
No Milestone
Projects
Clear projects
No project
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: starred/BookStack#1598
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @davidwaroquiers on GitHub (Mar 17, 2020).
It would be good that links from one page/chapter/book to another page/chapter/book are automatically updated when this other page/chapter/book is moved or modified.
This would allow BookStack users to make a link to a given page/chapter/book and if this page/chapter/book is modified or moved, the link continues to work while currently the link gets broken. Of course there are special cases that would never work (e.g. if you delete a page/chapter/book).
One small example to make things clear. Let's assume I have one book called "Ongoing projects" and another one called "Archived projects". I have a chapter "ProjectABC" in "Ongoing projects". I also have a book called "Miscellaneous" that has a page with a link to "ProjectABC" in "Ongoing projects". If I move "ProjectABC" from "Ongoing projects" to "Archived projects", the link to "ProjectABC" in "Miscellaneous" is broken.
Any thoughts on this ? I don't know if this is easily doable, or even if this is somewhat already possible (I did not find), and if this would be of any use for a large audience. I am a BookStack beginner and at this stage I am sure I cannot contribute to such a feature. Nonetheless, it might be that this could be the case in the longer-term but I have no clear view on that.
Thank you for your hard work.
@homotechsual commented on GitHub (Mar 17, 2020):
I'd like this idea to become reality - I don't know how much work it would be - but building the links at render-time using the underlying database/content IDs (or using a custom link handler like GitHub/MediaWiki do) - I do however suspect that this would be a fairly significant chunk of work.
@ssddanbrown commented on GitHub (Mar 18, 2020):
Thanks for the suggestion @davidwaroquiers. This is something that pops up often for various reasons. Rather than link to past discussions I thought I'd collate my up-to-date thoughts on this here, sorry if it seems like a bit of a ramble.
Current State
Just some insight into the current system, There are a couple of mechanisms within BookStack that can help alleviate (But definitely not remove) this issue:
My Thinking on Urls
I could have just used ID-based URLs in BookStack from the start, in fact that would make it much easier in terms of the code side of things, but I purposefully went out the way to have URLs with the content name in. I think there's a lot of value in providing some context in the URL. If that URL is shared then the receiver can instantly understand what that URL will likely lead to. Same when just coming across the URL in existing content.
Dynamic URLs have been suggested before, and there are even existing pull requests to incorporate such functionality, but it's really important to me that content is not stored in a way which needs to be dynamically parsed to be usable. User-created page content is the treasure of a BookStack instance. Control and portability of this content should remain with the user/admin as much as possible. Ideally I want it so that if someone's BookStack instance badly breaks, or the project becomes dead, the page content could be taken from the DB and re-used elsewhere without a great deal of hassle. It's the same reason we keep the generated HTML fairly flat with limited custom classes for styles. There is one feature that goes against this (Dynamic includes) but it's fairly hidden & suited for advanced users. Dynamic URL's also complicate the page editor systems quite significantly.
Moving Forward
I do acknowledge that the current potential for URL breaking can be an issue and ideally we want to ensure integrity when cross-linking and reduce any anxiety in performing such operations. I'll outlay a few options:
https://demo.bookstackapp.com/book/donkeys/page:553/barry-the-awesome-donkey.I'll mark this as open to discussion as I'd be interested in feedback and other potential ideas. Thank you @davidwaroquiers for making the goal of this feature request clear, instead of requesting a specific implementation right away, makes it easier to have an open discussion to find the best implementation.
@davidwaroquiers commented on GitHub (Mar 18, 2020):
Thanks for your very complete answer @ssddanbrown and all your thoughts about this.
Just wondering if a solution could be something like a "back-reference list". Let me explain. When you add a link to another page/chapter/book/shelve (let's call this the TARGET) in a given page/chapter/book (let's call this the CURRENTLY_EDITED_ITEM), the TARGET would (somehow, I don't know how and where) get the information that it has a link to itself from CURRENTLY_EDITED_ITEM (again, somehow stored in this "back-reference list"). Now if TARGET is moved, instead of having to make the full-page content search it "knows" that CURRENTLY_EDITED_ITEM has a link to itself (because it is in the "back-reference list") and it could update that link automatically (actually update all the links in possibly other items, be it pages or chapters or else). Of course your comment about revisions still holds.
There are a few tricks also. If we then remove the link to TARGET in CURRENTLY_EDITED_ITEM, it should of course be removed from the "back-reference list". Same if TARGET is moved itself or modified, the "back-reference list" should be updated accordingly. Also probably it would somehow mean that an "internal link" is handled differently from an "external link" (If I'm not wrong, these are actually handled the same way right ?). Also wondering about backward incompatibilities in that case ... if indeed internal BookStack links are handled differently than a link to an external webpage, one option might be that "old" internal links stay as they are and it's up to the user to update those if this feature gets out at some point.
Somehow to me it kind of looks like your solution 2. but without the burden of the full-page content search that is needed when a page/chapter/book is moved or modified, because the pages, chapters, books that have a link to the edited item are known.
Also, that would mean that there could possibly be an additional back-reference feature in each page/chapter/book, something like "what are the pages/chapters/books that currently have a link to me ?" (e.g. in the Actions menu, something that could be called "Citations" or anything else).
I don't know if this is possible/easy to do, but it's just a thought.
Again, thank you for all this work and for the project. This is great.
Best,
David
@ssddanbrown commented on GitHub (Mar 22, 2020):
@davidwaroquiers That's a really neat idea! Nice thinking!
Yeah, All links currently handled the same as far as I remember.
For that I'm thinking we should create a revision, so any "magic" BookStack is doing remains visible to the user and so they'll have the history in-case something goes work. It does mean that restoring an old revision may re-introduce broken links but hopefully that's a limited case, semi-expected & the new links will still be accessible via a revision if they want to merge content.
@setpill commented on GitHub (Apr 11, 2020):
Updating old references, to me, seems like an over-engineered solution. It would be better to switch to a url scheme that is both human-friendly (has the book/chapter/page title - at time of creation) as well as machine-friendly (has a (UU)ID reference so that the page can be found even if moved/renamed). That way, you solve the case where pages are linked from outside of bookstack (emails, for example) as well.
Auto-updating links might not even make sense! Take for example the following hierarchy:
What if I get everything I want for my home gym and move that project page from ongoing to past? I don't want that to auto-update the link in the "Overview" book. Maybe it would be possible to have a little indicator next to the link that the stub is outdated, and let whoever is taking care of that page decide what to do about it.
I'm not even sure of what the implications of auto-updating back-references would be if one changes the slug of a page that is referenced by pages one has no access to.
@Wookbert commented on GitHub (Feb 6, 2021):
Just ran into a misbehaviour which fits into this issue: The four links shown this image link to different pages in a chapter in a book called
Server – Installation & Wartung, which was renamed fromServers – Installation & Wartung(note the plural s). Strangely two links still worked, while the other two led to „Page not found“. If I manually fix those links they work again.If I rename the book again e.g. to
Serverz – ...,I get the same problem again: Two links get properly redirected (hovering over the links shows me that they are not changed, but getting redirected), while the other two are broken again.As far as I can tell, the URLs have been copied & pasted from the browser’s URL field. If that’s not the proper way to do it, may I suggest and additional button for local (= BookStack-internal) links?
I would imagine the following procedure:
An on-the-fly search function in that link selection window to instantly find the page you are looking for would be the icing on the cake. And a readable/scrollable page preview, to verify one’s correctly linking to the desired content, the cherry on top.
@rickhall commented on GitHub (Mar 17, 2021):
@Wookbert Your last suggestion of being able to drill down from books into the sections is just intuitively how I assumed it would work and was surprised when it didn't allow me to do that, so I'm in agreement with you on that.
Regarding the URL scheme, it does sound like it makes sense to adopt a hybrid approach that exposes both the ID and content. Although, for me personally, I'd also be fine with just the ID and not content. I understand the desire to include the content, but I think it is more idealism than necessity. For example, no one laments that YouTube URLs only include the video ID. Regardless, only exposing the content in the URL on a system designed for creating editable content is probably not the optimal choice.
Great work, nonetheless. Thanks.
@ssddanbrown commented on GitHub (Sep 5, 2022):
Thanks for the input all.
I did explore the idea of changing the URL scheme to be uid-based, within #3520, but I concluded thinking there's no ideal approach (That would satisfy all) and any change is going to have a lot of friction and ongoing consequences.
Instead I've looked to address this fairly directly along the lines of the suggestion by @davidwaroquiers above.
Storing/tracking backreferences has value in itself, as reflected in #2864.
Plus it allows us to address this issue now, without larger scale overhauls, in a fairly efficient manner.
The work for this has been primarily added as part of #3656, and will be part of the next feature release.
Note: This won't solve every possible scenario; For example, restoring old revisions may use old links, but this should take take of the vast majority of problematic cases. Further issues could be opened non-handled cases need to be addressed (If deemed worthwhile).
Note: You'll need to run a maintenance action or command to update this reference index for old pages, this will be detailed in release notes for the next version.