Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Never display the toc when it would be empty #532

Merged
merged 1 commit into from
Aug 27, 2021

Conversation

cljoly
Copy link
Contributor

@cljoly cljoly commented Aug 21, 2021

IMO, there is no point inserting a table of content if the page has no titles
because in this case, the table of contents is empty.

What does this PR change? What problem does it solve?
If TOC is enable on a page but the page has no titles, we end up with an empty TOC element, like so:
image
it make more sense in my opinion to avoid showing the table of content if it would be empty.
The alternative is that the user has to disable the TOC with the setting for each page that has no titles, a fairly manual and tedious process.

Was the change discussed in an issue or in the Discussions before?
No

PR Checklist

  • I have enabled maintainer edits for this PR.

  • This change does not include any CDN resources/links.

  • This change does not include any unrelated scripts such as bash and python scripts.

IMO, there is no point inserting a table of content if the page has no titles
because in this case, the table of contents is empty.
@sonarcloud
Copy link

sonarcloud bot commented Aug 21, 2021

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

Copy link
Owner

@adityatelange adityatelange left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome 👍 Thanks @cljoly

@adityatelange adityatelange merged commit e5ba027 into adityatelange:master Aug 27, 2021
@cljoly cljoly deleted the patch-1 branch August 27, 2021 20:41
kylethedeveloper pushed a commit to kylethedeveloper/hugo-PaperMod that referenced this pull request Feb 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants