File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44
55<div class =" {{ post_class }} " >
66 {{ #if feature_image }}
7- <img src =" {{ img_url feature_image size =" m" }} " class =" profile-image" >
7+ <img src =" {{ img_url feature_image size =" m" }} " class =" profile-image" >
88 {{ /if }}
99 <h1 >{{ title }} </h1 >
1010 <br >
11- {{ content }}
11+
12+ <aside class =" gh-sidebar" ><div class =" gh-toc" ></div ></aside >
13+ <div class =" post-content" >
14+ {{ content }}
15+ </div >
1216 <p ><em >{{ date published_at format =" MMMM DD, YYYY" }} </em ></p >
1317 <br >
1418</div >
2125
2226{{ #contentFor ' scripts' }}
2327 <script src =" {{ asset ' dist/post.js' }} " defer></script >
24- {{ /contentFor }}
28+ {{ /contentFor }}
Original file line number Diff line number Diff line change 2222
2323/* Vendor */
2424@import './vendors/ghost.css' ;
25+ @import '../../node_modules/tocbot/dist/tocbot.css' ;
Original file line number Diff line number Diff line change 3838 line-height : 1.25rem ;
3939 margin-bottom : 0.5em ;
4040}
41+
42+ /* tocbot stuff */
43+ .gh-toc > .toc-list {
44+ position : relative;
45+ margin-bottom : 1rem ;
46+ }
47+
48+ .toc-list {
49+ overflow : hidden;
50+ list-style : none;
51+ }
52+
53+ .toc-list-item {
54+ margin-bottom : 5px ;
55+ }
56+
4157@media (min-width : 400px ) {
4258 .post {
4359 width : 95% ;
6480 .post {
6581 width : 800px ;
6682 }
83+
84+ .gh-sidebar {
85+ position : absolute;
86+ left : 0 ;
87+ }
88+
89+ .gh-toc {
90+ position : sticky;
91+ top : 4vmin ;
92+ max-width : calc ((100vw - 800px ) / 2 );
93+ padding-right : 2rem ;
94+ }
95+ }
96+
97+ .gh-toc .is-active-link ::before {
98+ background-color : var (--ghost-accent-color );
6799}
Original file line number Diff line number Diff line change 11// Ship JS only active on post pages for better performance
2+ import tocbot from 'tocbot' ;
3+
4+ tocbot . init ( {
5+ // Where to render the table of contents.
6+ tocSelector : '.gh-toc' ,
7+ // Where to grab the headings to build the table of contents.
8+ contentSelector : '.post' ,
9+ // Which headings to grab inside of the contentSelector element.
10+ headingSelector : 'h2, h3, h4' ,
11+ // Ensure correct positioning
12+ hasInnerContainers : true ,
13+ } ) ;
You can’t perform that action at this time.
0 commit comments