]> BookStack Code Mirror - hacks/blob - content/page-export-contents/index.md
Added page export contents hack
[hacks] / content / page-export-contents / index.md
1 +++
2 title = "Page Export Contents List"
3 author = "@ssddanbrown"
4 date = 2023-03-16T00:00:00Z
5 updated = 2023-03-16T00:00:00Z
6 tested = "v23.02.1"
7 +++
8
9 This hack uses the visual theme system to customize the page export template file, used for both PDF and HTML exports, to add a simple linked "Contents" list to the top of the file, generated from the headers within the document.
10
11 #### Considerations
12
13 - The "Page Contents" header is hardcoded in English.
14 - This contents list will not show page numbers for the PDF export.
15 - The contents will show when headers are used in page content.
16 - This hack uses internal an "PageContent" content class, and it's methods, which will likely change in future BookStack versions.
17
18 #### Code
19
20 {{<hack file="exports/page.blade.php" type="visual">}}