forked from TryGhost/Starter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
custom-post-with-table-of-content.hbs
66 lines (59 loc) · 2.1 KB
/
custom-post-with-table-of-content.hbs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
{{!< default}}
{{#post}}
<div class="page-wrapper">
{{> bredcrumb}}
<div class="published-news-section">
<div class="container">
<div class="row">
<div class="col-md-12">
<div class="single-news-details">
{{> "post-header"}}
</div>
</div>
</div>
{{#if feature_image}}
<div class="row">
<div class="col-md-12">
<div class="news-picture">
<img loading="lazy" srcset="{{img_url feature_image size="s"}} 300w,
{{img_url feature_image size="m"}} 600w,
{{img_url feature_image size="l"}} 1000w,
{{img_url feature_image size="xl"}} 2000w"
sizes="(max-width: 800px) 400px,
(max-width: 1170px) 700px,
1400px" src="data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=" data-src="{{img_url feature_image size="xl"}}" alt="{{title}}">
</div>
</div>
</div>
{{/if}}
</div>
</div>
</div>
{{!-- News-full-content --}}
<div class="post-without-sidebar-area mt-30">
<div class="container">
<div class="row">
<div class="col-md-10 mx-auto">
{{> content table_contents="true"}}
</div>
</div>
</div>
</div>
{{!-- Related Posts --}}
{{> related-posts}}
{{/post}}
{{#contentFor "scripts"}}
<script>
// tocbot
tocbot.init({
tocSelector: '.toc',
contentSelector: '.toc-content',
headingSelector: 'h2, h3',
hasInnerContainers: true,
});
$(".toc-wrap").hide();
if( $(".toc").children().length > 0 ){
$(".toc-wrap").show();
}
</script>
{{/contentFor}}