Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
synapse
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Timo Ley
synapse
Commits
0922462f
Unverified
Commit
0922462f
authored
2 years ago
by
Andrew Morgan
Committed by
GitHub
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
docs: Don't render the table of contents on the print page (#12340)
parent
73d8ded0
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
changelog.d/12340.doc
+1
-0
1 addition, 0 deletions
changelog.d/12340.doc
docs/website_files/table-of-contents.js
+14
-0
14 additions, 0 deletions
docs/website_files/table-of-contents.js
with
15 additions
and
0 deletions
changelog.d/12340.doc
0 → 100644
+
1
−
0
View file @
0922462f
Fix rendering of the documentation site when using the 'print' feature.
This diff is collapsed.
Click to expand it.
docs/website_files/table-of-contents.js
+
14
−
0
View file @
0922462f
...
...
@@ -75,6 +75,20 @@ function setTocEntry() {
* Populate sidebar on load
*/
window
.
addEventListener
(
'
load
'
,
()
=>
{
// Prevent rendering the table of contents of the "print book" page, as it
// will end up being rendered into the output (in a broken-looking way)
// Get the name of the current page (i.e. 'print.html')
const
pageNameExtension
=
window
.
location
.
pathname
.
split
(
'
/
'
).
pop
();
// Split off the extension (as '.../print' is also a valid page name), which
// should result in 'print'
const
pageName
=
pageNameExtension
.
split
(
'
.
'
)[
0
];
if
(
pageName
===
"
print
"
)
{
// Don't render the table of contents on this page
return
;
}
// Only create table of contents if there is more than one header on the page
if
(
headers
.
length
<=
1
)
{
return
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment