Added TOC support (#985)
### Prerequisites
Put an `x` into the box(es) that apply:
- [ ] This pull request fixes a bug.
- [x] This pull request adds a feature.
- [ ] This pull request introduces breaking change.
### Description
Adds "Table of Contents" functionality for posts. I believe this was not
implemented before, and I use it on my site.
### Issues Resolved
List any existing issues this pull request resolves.
### Checklist
Put an `x` into the box(es) that apply:
#### General
- [x] Describe what changes are being made
- [x] Explain why and how the changes were necessary and implemented
respectively
- [ ] Reference issue with `#<ISSUE_NO>` if applicable
#### Resources
- [ ] If you have changed any SCSS code, run `make release` to
regenerate all CSS files
#### Contributors
- [x] Add yourself to `CONTRIBUTORS.md` if you aren't on it already
2 files modified
1 files added
| | |
| | | |
| | | [link_to_heading] |
| | | other = "Link to heading" |
| | | |
| | | [entry_toc] |
| | | other = "Table of Contents" |
| New file |
| | |
| | | {{- $toc := default .Site.Params.Entry.toc .Params.toc -}} |
| | | {{- $tocOpen := default .Site.Params.Entry.tocOpen .Params.tocOpen -}} |
| | | |
| | | {{- if $toc }} |
| | | <details class="entry__toc toc" {{ if $tocOpen }}open{{ end }}> |
| | | <summary class="toc__title">{{- T "entry_toc" -}}</summary> |
| | | {{ .TableOfContents }} |
| | | </details> |
| | | {{- end }} |
| | |
| | | </div> |
| | | </header> |
| | | |
| | | {{ partial "toc.html" . }} |
| | | |
| | | <div class="post-content"> |
| | | {{ if .Params.featuredImage }} |
| | | <img src="{{ .Params.featuredImage | relURL }}" alt="Featured image"/> |