Add comments support (#133)

This commit is contained in:
Sodbileg Gansukh
2022-08-12 21:53:28 +08:00
committed by Hannah Wolfe
parent 4033e58524
commit 36d7c90fb6
4 changed files with 40 additions and 23 deletions

View File

@@ -110,6 +110,9 @@
}
.gh-card-meta {
display: inline-flex;
gap: 6px;
align-items: center;
margin-top: 2rem;
font-size: 1.2rem;
font-weight: 500;
@@ -122,17 +125,26 @@
color: var(--ghost-accent-color);
}
.gh-card-meta-wrapper {
display: inline-flex;
align-items: center;
}
.gh-card-meta-wrapper svg {
.gh-card-meta svg {
position: relative;
top: -1px;
margin-left: 0.6rem;
}
.gh-card-meta > * {
display: flex;
gap: 6px;
align-items: center;
}
.gh-card-meta > * + *:not(script)::before {
width: 2px;
height: 2px;
content: "";
background-color: var(--color-secondary-text);
border-radius: 50%;
}
.gh-loadmore {
width: 100%;
padding-top: 1.4rem;
@@ -377,6 +389,11 @@
border-top: 1px solid var(--color-light-gray);
}
.gh-article-footer.no-border {
margin-top: 24px;
border-top: 0;
}
.gh-navigation {
grid-column: wide-start / wide-end;
}

View File

@@ -11,20 +11,17 @@
<div class="gh-article-meta">
<span class="gh-card-date">Latest — <time datetime="{{date format="YYYY-MM-DD"}}">{{date}}</time></span>
</div>
<h2 class="gh-article-title gh-card-title">{{title}}</h2>
</header>
<p class="gh-article-excerpt">{{excerpt}}</p>
<footer class="gh-card-meta">
<span class="gh-card-meta-wrapper">
<span class="gh-card-duration">{{reading_time}}</span>
{{^has visibility="public"}}
{{> icons/star}}
{{/has}}
</span>
<span class="gh-card-duration">{{reading_time}}</span>
{{comment_count class="gh-card-comments"}}
{{^has visibility="public"}}
{{> icons/star}}
{{/has}}
</footer>
</a>
</article>

View File

@@ -8,14 +8,11 @@
<footer class="gh-card-meta">
<time class="gh-card-date" datetime="{{date format="YYYY-MM-DD"}}">{{date}}</time>
<span class="gh-card-meta-wrapper">
<span class="gh-card-duration">{{reading_time}}</span>
{{^has visibility="public"}}
{{> icons/star}}
{{/has}}
</span>
<span class="gh-card-duration">{{reading_time}}</span>
{{comment_count class="gh-card-comments"}}
{{^has visibility="public"}}
{{> icons/star}}
{{/has}}
</footer>
</a>
</article>

View File

@@ -46,8 +46,14 @@
{{content}}
</div>
{{#if comments}}
<div class="gh-comments gh-canvas">
{{comments}}
</div>
{{/if}}
{{#is "post"}}
<footer class="gh-article-footer gh-canvas">
<footer class="gh-article-footer gh-canvas{{#if @site.comments_enabled}}{{#unless @member}} no-border{{/unless}}{{#unless access}} no-border{{/unless}}{{/if}}">
<nav class="gh-navigation">
<div class="gh-navigation-previous">
{{#prev_post}}