Skip to content

Commit d687d0f

Browse files
minimaluminiumpeterzimonsanne-sanmoreofmorris
authored
Add comments support (#893)
* Added comments to theme * Cleanup * Updated spacing and typography * Removed bottom border * Added comment counter * Updated theme name and post template * Added search support * Compiled css for search * Removed the border and brackets for comment count * Moved the comments helper into the content block so it gets the same paddings at narrow viewports * Package version bump * Updated comments helper in post template * Final tweaks for the comments support * Revert the package info * Update {{comment_count}} helper usage The helper now outputs a span wrapper by default, so we won't have to add a wrapper in the theme Co-authored-by: Peter Zimon <peter.zimon@gmail.com> Co-authored-by: Sanne de Vries <sannedv@protonmail.com> Co-authored-by: James Morris <moreofmorris@users.noreply.github.com>
1 parent 96f69f8 commit d687d0f

File tree

6 files changed

+134
-47
lines changed

6 files changed

+134
-47
lines changed

assets/built/portal.min.js

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

assets/built/screen.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

assets/built/screen.css.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

assets/css/screen.css

Lines changed: 119 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ production stylesheet in assets/built/screen.css
1515
7.2. Members Subscribe Form
1616
7.4. Related Posts
1717
7.5. Koenig Styles
18+
7.6 Comments
1819
8. Author Template
1920
9. Error Template
2021
11. Site Footer
@@ -416,6 +417,35 @@ body:not(.has-cover) .site-header-content:not(.left-aligned) {
416417
background: #fff;
417418
}
418419

420+
/* Search
421+
/* ---------------------------------------------------------- */
422+
423+
.gh-search {
424+
display: inline-flex;
425+
align-items: center;
426+
justify-content: center;
427+
width: 32px;
428+
height: 32px;
429+
padding: 0;
430+
cursor: pointer;
431+
background-color: transparent;
432+
border: 0;
433+
outline: none;
434+
}
435+
436+
.gh-search:hover {
437+
opacity: 0.9;
438+
}
439+
440+
@media (max-width: 991px) {
441+
.gh-search {
442+
position: fixed;
443+
top: 16px;
444+
left: 16px;
445+
z-index: 10;
446+
}
447+
}
448+
419449

420450
/* Search
421451
/* ---------------------------------------------------------- */
@@ -830,12 +860,27 @@ body:not(.gh-head-open) .gh-burger:hover .gh-burger-inner::after {
830860
.post-card-meta {
831861
display: flex;
832862
align-items: center;
863+
gap: 6px;
833864
margin-top: 12px;
834865
padding: 0;
835866
font-size: 1.3rem;
836867
color: var(--color-secondary-text);
837868
}
838869

870+
.post-card-meta > * {
871+
display: flex;
872+
align-items: center;
873+
gap: 6px;
874+
}
875+
876+
.post-card-meta > * + *:not(script)::before {
877+
width: 2px;
878+
height: 2px;
879+
content: "";
880+
background-color: var(--color-secondary-text);
881+
border-radius: 50%;
882+
}
883+
839884
.post-card-meta .sep {
840885
margin: 0 4px;
841886
}
@@ -1595,6 +1640,43 @@ iframe.instagram-media + script + :not([id]) {
15951640
}
15961641
}
15971642

1643+
/* 7.6. Comments
1644+
/* ---------------------------------------------------------- */
1645+
.comments {
1646+
display: flex;
1647+
flex-direction: column;
1648+
align-items: center;
1649+
margin: 60px 0 44px;
1650+
}
1651+
1652+
1653+
.comments-head {
1654+
display: flex;
1655+
align-items: baseline;
1656+
justify-content: space-between;
1657+
margin-bottom: 32px;
1658+
width: 100%;
1659+
max-width: 720px;
1660+
}
1661+
1662+
.comments h2 {
1663+
width: 100%;
1664+
max-width: 720px;
1665+
font-weight: 800;
1666+
font-size: 3.4rem;
1667+
}
1668+
1669+
.comments .comment-count {
1670+
color: var(--color-midgrey);
1671+
font-weight: 600;
1672+
white-space: nowrap;
1673+
}
1674+
1675+
.comments #ghost-comments-root {
1676+
width: 100%;
1677+
max-width: 720px;
1678+
}
1679+
15981680

15991681
/* 8. Author Template
16001682
/* ---------------------------------------------------------- */
@@ -2004,48 +2086,48 @@ html.dark-mode .footer-cta-title {
20042086
color: rgba(255, 255, 255, 0.75);
20052087
background: var(--color-darkmode);
20062088
}
2007-
2089+
20082090
html.auto-color img {
20092091
opacity: 0.9;
20102092
}
2011-
2093+
20122094
html.auto-color kbd {
20132095
background: color-mod(var(--color-darkmode) l(+5%));
20142096
}
2015-
2097+
20162098
html.auto-color figcaption a {
20172099
color: #fff;
20182100
}
2019-
2101+
20202102
html.auto-color .gh-head {
20212103
background: var(--color-darkmode);
20222104
color: #fff;
20232105
}
2024-
2106+
20252107
html.auto-color .gh-burger-box {
20262108
color: #fff;
20272109
}
2028-
2110+
20292111
html.auto-color .site-header-content {
20302112
color: #fff;
20312113
}
2032-
2114+
20332115
html.auto-color .post-card-image {
20342116
background: var(--color-darkmode);
20352117
}
2036-
2118+
20372119
html.auto-color :is(.post-card-tags, .post-card-meta, .article-tag a, .byline-meta-content) {
20382120
color: color-mod(var(--color-secondary-text) l(-22%));
20392121
}
2040-
2122+
20412123
html.auto-color .post-card-featured {
20422124
color: #fff;
20432125
}
2044-
2126+
20452127
html.auto-color .post-card-title {
20462128
color: #fff;
20472129
}
2048-
2130+
20492131
html.auto-color .post-card-excerpt {
20502132
color: var(--color-secondary-text);
20512133
}
@@ -2061,11 +2143,11 @@ html.dark-mode .footer-cta-title {
20612143
html.auto-color .article-title {
20622144
color: #fff;
20632145
}
2064-
2146+
20652147
html.auto-color .article-excerpt {
20662148
color: var(--color-secondary-text);
20672149
}
2068-
2150+
20692151
html.auto-color .post-full-image {
20702152
background-color: color-mod(var(--color-darkmode) l(+8%));
20712153
}
@@ -2074,107 +2156,107 @@ html.dark-mode .footer-cta-title {
20742156
border-color: var(--color-darkmode);
20752157
background-color: color-mod(var(--color-darkmode) l(+8%));
20762158
}
2077-
2159+
20782160
html.auto-color .author-profile-image {
20792161
opacity: 1;
20802162
}
2081-
2163+
20822164
html.auto-color .author-profile-image path {
20832165
fill: var(--color-darkmode);
20842166
}
2085-
2167+
20862168
html.auto-color .article-byline-meta .author-name a {
20872169
color: #fff;
20882170
}
2089-
2171+
20902172
html.auto-color .no-image .author-social-link a {
20912173
color: rgba(255, 255, 255, 0.75);
20922174
}
2093-
2175+
20942176
html.auto-color .gh-content > [id] {
20952177
color: rgba(255, 255, 255, 0.9);
20962178
}
2097-
2179+
20982180
html.auto-color .gh-content pre {
20992181
background: color-mod(var(--color-darkgrey) l(-8%));
21002182
}
2101-
2183+
21022184
html.auto-color .gh-content :not(pre) > code {
21032185
background: color-mod(var(--color-darkgrey) l(+6%));
21042186
border-color: color-mod(var(--color-darkmode) l(+8%));
21052187
color: var(--color-wash);
21062188
}
2107-
2189+
21082190
html.auto-color .gh-content a:not(.kg-btn):not(.kg-nft-card-container):not(.kg-product-card-button):not(.kg-header-card-button) {
21092191
color: #fff;
21102192
}
2111-
2193+
21122194
html.auto-color .gh-content strong {
21132195
color: #fff;
21142196
}
2115-
2197+
21162198
html.auto-color .gh-content em {
21172199
color: #fff;
21182200
}
2119-
2201+
21202202
html.auto-color .gh-content code {
21212203
color: #fff;
21222204
background: #000;
21232205
}
2124-
2206+
21252207
html.auto-color hr {
21262208
border-top-color: color-mod(var(--color-darkmode) l(+8%));
21272209
}
2128-
2210+
21292211
html.auto-color .gh-content hr:after {
21302212
background: color-mod(var(--color-darkmode) l(+8%));
21312213
box-shadow: var(--color-darkmode) 0 0 0 5px;
21322214
}
2133-
2215+
21342216
html.auto-color figcaption {
21352217
color: rgba(255, 255, 255, 0.6);
21362218
}
2137-
2219+
21382220
html.auto-color .gh-content table td:first-child {
21392221
background-image: linear-gradient(to right, var(--color-darkmode) 50%, color-mod(var(--color-darkmode) a(0%)) 100%);
21402222
}
2141-
2223+
21422224
html.auto-color .gh-content table td:last-child {
21432225
background-image: linear-gradient(to left, var(--color-darkmode) 50%, color-mod(var(--color-darkmode) a(0%)) 100%);
21442226
}
2145-
2227+
21462228
html.auto-color .gh-content table th {
21472229
color: rgba(255, 255, 255, 0.85);
21482230
background-color: color-mod(var(--color-darkmode) l(+8%));
21492231
}
2150-
2232+
21512233
html.auto-color .gh-content table th,
21522234
html.auto-color .gh-content table td {
21532235
border: color-mod(var(--color-darkmode) l(+8%)) 1px solid;
21542236
}
2155-
2237+
21562238
html.auto-color .gh-content input {
21572239
color: color-mod(var(--color-midgrey) l(-30%));
21582240
}
2159-
2241+
21602242
html.auto-color .site-archive-header .no-image {
21612243
color: rgba(255, 255, 255, 0.9);
21622244
background: var(--color-darkmode);
21632245
}
2164-
2246+
21652247
html.auto-color .kg-header-card.kg-style-dark {
21662248
background: color-mod(var(--color-darkgrey) l(-5%));
21672249
}
2168-
2250+
21692251
html.auto-color .kg-header-card.kg-style-light {
21702252
background: color-mod(var(--color-darkgrey) l(+5%));
21712253
}
2172-
2254+
21732255
html.auto-color .kg-header-card h2.kg-header-card-header,
21742256
html.auto-color .kg-header-card h3.kg-header-card-subheader {
21752257
color: #fff;
21762258
}
2177-
2259+
21782260
html.auto-color .footer-cta-title {
21792261
color: #fff;
21802262
}

partials/post-card.hbs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,11 @@ which templates loop over to generate a list of posts. --}}
6666
<footer class="post-card-meta">
6767
<time class="post-card-meta-date" datetime="{{date format="YYYY-MM-DD"}}">{{date}}</time>
6868
{{#if reading_time}}
69-
<span class="sep">—</span>
7069
<span class="post-card-meta-length">{{reading_time}}</span>
7170
{{/if}}
71+
{{#if @site.comments_enabled}}
72+
{{comment_count}}
73+
{{/if}}
7274
</footer>
7375

7476
</div>

post.hbs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -86,18 +86,19 @@ into the {body} tag of the default.hbs template --}}
8686
{{content}}
8787
</section>
8888

89-
{{!--
90-
<section class="article-comments gh-canvas">
91-
If you want to embed comments, this is a good place to paste your code!
92-
</section>
93-
--}}
89+
{{#if comments}}
90+
<section class="article-comments gh-canvas">
91+
{{comments}}
92+
</section>
93+
{{/if}}
9494

9595
</article>
9696
</main>
9797

9898
{{!-- A signup call to action is displayed here, unless viewed as a logged-in member --}}
9999
{{#if @site.members_enabled}}
100100
{{#unless @member}}
101+
{{#unless @site.comments_enabled}}
101102
{{#if access}}
102103
<section class="footer-cta outer">
103104
<div class="inner">
@@ -106,12 +107,11 @@ into the {body} tag of the default.hbs template --}}
106107
<div class="footer-cta-input">Enter your email</div>
107108
<span>Subscribe</span>
108109
</a>
109-
{{!-- ^ This looks like a form element, but it's just a link to Portal,
110-
making the form validation and submission much simpler. --}}
111110
</div>
112111
</section>
113112
{{/if}}
114113
{{/unless}}
114+
{{/unless}}
115115
{{/if}}
116116

117117

0 commit comments

Comments
 (0)