This BookStack theme module adds a copyable, stable permalink entry to the Details sidebar for shelves, books, chapters and pages.
The generated links are ID-based so they remain valid even when:
- the page title changes
- the book name changes
- the shelf, book or chapter slug changes
For pages, the existing BookStack permalink route /link/{id} is used.
For books, chapters and shelves, this module adds equivalent redirect routes:
/link/book/{id}/link/chapter/{id}/link/shelf/{id}
When opened, these permalinks redirect to the current canonical BookStack URL for the target entity.
- BookStack v26.03 or newer (the module uses BookStack's adjacent-view registration API).
- This is an unsupported customization built on BookStack's theme/module system.
- It adds custom authenticated web routes for book, chapter and shelf permalinks.
- The copy interaction and confirmation popup depend on JavaScript.
- The permalink is always displayed in the popup so it can be selected and copied manually if browser clipboard access fails.
Preferred install method:
php artisan bookstack:install-module https://github.com/patattzel/bookstack-persistent-permalinks/releases/latest/download/bookstack-persistent-permalinks.zipRequirements:
- an active BookStack theme to already be configured
- a published GitHub release containing
bookstack-persistent-permalinks.zip
BookStack expects a real module ZIP where bookstack-module.json exists at the ZIP root.
The normal GitHub repository source ZIP is not suitable for bookstack:install-module.
This repository includes:
scripts/package-module.shto build a compatible ZIP locally intodist/bookstack-persistent-permalinks.zip.github/workflows/release-module-zip.ymlto attach that ZIP to GitHub releases
Release flow for maintainers:
- Create a GitHub release from this repository.
- The GitHub Action builds
bookstack-persistent-permalinks.zip. - The workflow uploads that ZIP as a release asset.
- Users can then install via the
releases/latest/download/...URL above.
To build the installable ZIP locally:
bash scripts/package-module.shThis repository is a standalone module package, not a full theme.
Copy or clone the repository into your active theme's modules folder, for example:
cd /path/to/bookstack/themes/<your-active-theme>/modules
git clone https://github.com/patattzel/bookstack-persistent-permalinks.git persistent-permalinksResult:
themes/<your-active-theme>/modules/persistent-permalinks/
This repository is itself a BookStack theme module package:
bookstack-persistent-permalinks/
├── bookstack-module.json
├── functions.php
├── lang/
├── public/
└── views/
The package contains:
bookstack-module.jsonfor module metadatafunctions.phpfor route and adjacent-view registrationviews/for the permalink row inserted after BookStack's entity metadatalang/for label and toast textpublic/for the permalink copy JavaScriptscripts/package-module.shfor creating a BookStack-compatible release ZIP
Open any shelf, book, chapter or page view in BookStack.
In the Details sidebar you will see a Copy permalink row.
Clicking that row copies the stable permalink to the clipboard without opening it. A confirmation popup displays the permalink for manual copying and also provides a Copy again action.
The module inserts its own view after BookStack's entities.meta view instead of overriding complete sidebar templates. This keeps BookStack's sidebar and configurable layout updates intact. When opened, the popup is moved to the document body so transformed or layered custom layouts cannot trap it in a sidebar stacking context.
Clipboard writes use the modern Clipboard API in secure contexts and automatically fall back to the browser copy command if that API is unavailable or rejects the request. The sidebar action is a button rather than a link, so it cannot accidentally navigate to the permalink when JavaScript or clipboard access fails. The small module assets are embedded into the page with the BookStack CSP nonce, avoiding web-server-specific MIME type detection for theme JavaScript.
Run the JavaScript tests and basic syntax checks with:
node --test tests/permalink-copy.test.mjs
php -l functions.php
node --check public/permalink-copy.js
bash scripts/package-module.sh
unzip -t dist/bookstack-persistent-permalinks.zipMain implementation paths:
functions.phpviews/permalink-module/details-link.blade.phppublic/permalink-copy.jspublic/permalink-copy.css