Dynamic Links for Internal Pages #591

Closed
opened 2026-02-04 21:20:52 +03:00 by OVERLORD · 3 comments
Owner

Originally created by @timconner on GitHub (Mar 5, 2018).

Enhancement Request

BookStack currently creates all links as hard coded static links which causes links to easily become broken.

As it stands these actions will cause broken links to a page:

  • Renaming the Page
  • Moving the Page
  • Changing the name of the Chapter the page is in.
  • Changing the name of the Book the page is in.
  • Changing the server name of BookStacks. (e.g. books.company.com to docs.company.com)

Proposed Change:
Leverage database to generate dynamic links to entities internal to the BookStack instance when pages are rendered. This would require some type of markdown for identifying that a link is to an internal entity (Book/Chapter/Page) and the id of that page.

Originally created by @timconner on GitHub (Mar 5, 2018). **Enhancement Request** BookStack currently creates all links as hard coded static links which causes links to easily become broken. As it stands these actions will cause broken links to a page: - Renaming the Page - Moving the Page - Changing the name of the Chapter the page is in. - Changing the name of the Book the page is in. - Changing the server name of BookStacks. (e.g. books.company.com to docs.company.com) **Proposed Change:** Leverage database to generate dynamic links to entities internal to the BookStack instance when pages are rendered. This would require some type of markdown for identifying that a link is to an internal entity (Book/Chapter/Page) and the id of that page.
OVERLORD added the 🛠️ Enhancement Open to discussion labels 2026-02-04 21:20:52 +03:00
Author
Owner

@timconner commented on GitHub (Mar 7, 2018):

Update: Most of the previously stated changes do not actually cause broken links as the history lookup routine does a pretty good job of finding the page and redirecting the browser to it's new location. However, if you ever link to a deleted book it seems to break that functionality. I would still be more comfortable with an internal linking system that doesn't rely on revision lookup.

Also, I have created a PR that has the beginnings of an internal linking system. I piggy backed off the current transclusion system, but the editing UI doesn't have any of the needed changes yet. I want to come up with a way to also determine if the link is to a Book or Chapter as well.

We have this precedent for pages thanks to the transclusion system: {{@page-id}}

Need something similar for Book and Chapters.

@timconner commented on GitHub (Mar 7, 2018): **Update:** Most of the previously stated changes do not actually cause broken links as the history lookup routine does a pretty good job of finding the page and redirecting the browser to it's new location. However, if you ever link to a deleted book it seems to break that functionality. I would still be more comfortable with an internal linking system that doesn't rely on revision lookup. Also, I have created a PR that has the beginnings of an internal linking system. I piggy backed off the current transclusion system, but the editing UI doesn't have any of the needed changes yet. I want to come up with a way to also determine if the link is to a Book or Chapter as well. We have this precedent for pages thanks to the transclusion system: {{@page-id}} Need something similar for Book and Chapters.
Author
Owner

@timconner commented on GitHub (Mar 7, 2018):

Current thought would be something like this:
Chapters: {{{@chapter-id}}}
Books: {{{{@book-id}}}}

This could go well with the other enhancement request asking for "Book Shelves" for grouping books together which would just be one step further: {{{{{@shelf-id}}}}}

@timconner commented on GitHub (Mar 7, 2018): Current thought would be something like this: Chapters: {{{@chapter-id}}} Books: {{{{@book-id}}}} This could go well with the other enhancement request asking for "Book Shelves" for grouping books together which would just be one step further: {{{{{@shelf-id}}}}}
Author
Owner

@ssddanbrown commented on GitHub (Nov 8, 2022):

I'm going to go ahead and close this off since the current state of things is quite different compared to when this was opened. Many of the listed link breaking scenarios should now be handled by our references system, and base URL changes are now assisted with a built-in command. If there are common scenarios which are not properly handled we can address them individually.

If you're coming to this in the future, Please note that there's extra context within #737.
I still feel the same, in that I don't want to introduce additional complexity to content, and therefore its usages. I want to keep proprietary magic out of content where possible.

@ssddanbrown commented on GitHub (Nov 8, 2022): I'm going to go ahead and close this off since the current state of things is quite different compared to when this was opened. Many of the listed link breaking scenarios should now be handled by our references system, and base URL changes are now assisted with a built-in command. If there are common scenarios which are not properly handled we can address them individually. If you're coming to this in the future, Please note that there's extra context within #737. I still feel the same, in that I don't want to introduce additional complexity to content, and therefore its usages. I want to keep proprietary magic out of content where possible.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#591