Skip to content

Commit

Permalink
feat: apply scrollspy to table of contents
Browse files Browse the repository at this point in the history
  • Loading branch information
razonyang committed Jul 30, 2022
1 parent 3b9e8ad commit 8c4a5fb
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
6 changes: 6 additions & 0 deletions assets/main/scss/post/_toc.scss
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,10 @@
li {
margin-bottom: 0.25rem;
}

a {
&.active {
color: var(--#{$prefix}primary);
}
}
}
2 changes: 1 addition & 1 deletion layouts/partials/docs/post.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ <h1 class="card-title post-title my-2">{{ partial "helpers/title" . }}</h1>
{{- partial "post/meta" . -}}
{{- partial "post/featured-image" . -}}
{{- partial "hooks/content-begin" . -}}
<div class="post-content mb-3">
<div class="post-content mb-3" data-bs-spy="scroll" data-bs-target="#TableOfContents" tabindex="0">
{{- .Content -}}
</div>
{{- partial "post/reward" . -}}
Expand Down
2 changes: 1 addition & 1 deletion layouts/partials/post.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ <h1 class="card-title post-title my-2">{{ partial "helpers/title" . }}</h1>
{{- partial "post/toc" . -}}
{{- end -}}
{{- partial "post/share" . -}}
<div class="post-content mb-3">
<div class="post-content mb-3" data-bs-spy="scroll" data-bs-target="#TableOfContents" tabindex="0">
{{- .Content -}}
</div>
{{- partial "post/reward" . -}}
Expand Down

0 comments on commit 8c4a5fb

Please sign in to comment.