-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpost.hbs
145 lines (114 loc) · 5.01 KB
/
post.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
{{!< default}}
{{!-- The tag above means: insert everything in this file
into the {body} of the default.hbs template --}}
<header class="site-header">
{{> site-header}}
</header>
{{!-- Everything inside the #post tags pulls data from the post --}}
{{#post}}
<main id="site-main" class="site-main outer">
<div class="inner">
<article class="post-full {{post_class}} {{#unless feature_image}}no-image{{/unless}}">
<header class="post-full-header">
<h1 class="post-full-title">{{title}}</h1>
<div class="post-full-byline">
<section class="post-full-byline-content">
<section class="post-full-byline-meta">
<div class="byline-meta-content">
{{#if tags}}
<span class="post-full-tags">
{{#foreach tags}}<a href="{{url}}"
title="{{name}}">{{name}}</a>{{/foreach}}
</span>
<span> | </span>
{{/if}}
<span class="byline-meta-date">
<time datetime="{{date format="YYYY-MM-DD"}}">
{{date published_at}}
</time>
</span>
<span> | By:
{{authors}}
</span>
</div>
</section>
</section>
</div>
{{> "sharing"}}
</header>
{{#if feature_image}}
<figure class="post-full-image">
{{!-- This is a responsive image, it loads different sizes depending on device
https://medium.freecodecamp.org/a-guide-to-responsive-images-with-ready-to-use-templates-c400bd65c433 --}}
<img
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) 1170px,
2000px"
src="{{img_url feature_image size="xl"}}"
alt="{{title}}"
/>
</figure>
{{/if}}
{{!-- if the user has access to this post, show it to them --}}
{{#if access}}
<section class="post-full-content">
<div class="post-content">
{{content}}
</div>
</section>
{{!-- Email subscribe form at the bottom of the page --}}
{{#unless @member}}
{{> post-cta}}
{{/unless}}
{{!-- if the user does not have access, show them an upgrade CTA --}}
{{else}}
<section class="post-full-content">
<div class="post-content">
<p>{{excerpt words="300"}}</p>
</div>
<aside class="post-upgrade-cta">
<div class="post-cta-inner">
<h2 class="subscribe-form-title-alternate">Please subscribe to continue reading</h2>
{{> subscribe-form}}
<p class="subscribe-form-description-alternate"><small>Already have an account? <a href="/signin/">Sign in</a></small></p>
</div>
</aside>
</section>
{{/if}}
{{!-- Related posts after subscribe CTA --}}
{{#get "posts" filter="tags:{{primary_tag.slug}}+id:-{{id}}" limit="2" as |related_posts|}}
{{#if related_posts}}
<section class="related-posts-container">
<h3 class="related-posts-title"><span class="text">You might also like...</span></h3>
<div class="post-feed">
{{#foreach related_posts }}
{{> "post-card"}}
{{/foreach}}
</div>
</section>
{{/if}}
{{/get}}
{{!--
<section class="post-full-comments">
If you want to embed comments, this is a good place to do it!
</section>
--}}
</article>
</div>
</main>
{{/post}}
{{!-- The #contentFor helper here will send everything inside it up to the matching #block helper found in default.hbs --}}
{{#contentFor "scripts"}}
<script>
$(document).ready(function () {
// FitVids - start
var $postContent = $(".post-full-content");
$postContent.fitVids();
// FitVids - end
});
</script>
{{/contentFor}}