mirror of
https://github.com/gcushen/hugo-academic.git
synced 2025-07-26 19:15:16 +02:00
posts: Option to show comment count + move tags to article footer
* add `comment_count = true` to config * add `section_pager = false` to config to disable pager by default * move tags from post metadata bar to post footer
This commit is contained in:
parent
ff2690fcb8
commit
3c86dd848f
5 changed files with 59 additions and 20 deletions
|
@ -60,6 +60,12 @@ defaultContentLanguageInSubdir = false
|
|||
# Show estimated reading time for posts?
|
||||
reading_time = true
|
||||
|
||||
# Display comment count? Requires commenting to be enabled.
|
||||
comment_count = true
|
||||
|
||||
# Display section pager for posts?
|
||||
section_pager = false
|
||||
|
||||
# Enable global LaTeX math rendering?
|
||||
# If false, you can enable it locally on a per page basis.
|
||||
math = false
|
||||
|
|
|
@ -11,13 +11,26 @@
|
|||
<div class="article-style" itemprop="articleBody">
|
||||
{{ .Content }}
|
||||
</div>
|
||||
|
||||
{{ if isset $.Params "tags" }}
|
||||
{{ $tagsLen := len $.Params.tags }}
|
||||
{{ if gt $tagsLen 0 }}
|
||||
<div class="article-tags">
|
||||
{{ range $k, $v := $.Params.tags }}
|
||||
<a class="btn btn-primary btn-outline" href="{{ "/tags/" | relLangURL }}{{ . | urlize | lower }}">{{ . }}</a>
|
||||
{{ end }}
|
||||
</div>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
</div>
|
||||
|
||||
</article>
|
||||
|
||||
{{ $related := .Site.RegularPages.Related . | first 5 }}
|
||||
{{ with $related }}
|
||||
<div class="article-container">
|
||||
<div class="article-container article-widget">
|
||||
<div class="hr-light"></div>
|
||||
<h3>{{ i18n "related" }}</h3>
|
||||
<ul>
|
||||
{{ range . }}
|
||||
|
@ -27,9 +40,11 @@
|
|||
</div>
|
||||
{{ end }}
|
||||
|
||||
<div class="container">
|
||||
{{ if .Site.Params.section_pager }}
|
||||
<div class="container article-widget">
|
||||
{{ partial "section_pager.html" . }}
|
||||
</div>
|
||||
{{ end }}
|
||||
|
||||
<div class="article-container">
|
||||
{{ partial "comments.html" . }}
|
||||
|
|
|
@ -12,14 +12,22 @@
|
|||
</span>
|
||||
|
||||
{{ if ne $.Site.Params.reading_time false }}
|
||||
<span class="middot-divider"></span>
|
||||
<span class="article-reading-time">
|
||||
{{ $.ReadingTime }} {{ i18n "minute_read" }}
|
||||
</span>
|
||||
{{ end }}
|
||||
|
||||
{{ $comments_enabled := and $.Site.DisqusShortname (not (or $.Site.Params.disable_comments $.Params.disable_comments)) }}
|
||||
{{ if and $comments_enabled ($.Site.Params.comment_count | default true) }}
|
||||
<span class="middot-divider"></span>
|
||||
<a href="{{ $.Permalink }}#disqus_thread"><!-- Count will be inserted here --></a>
|
||||
{{ end}}
|
||||
|
||||
{{ if isset $.Params "categories" }}
|
||||
{{ $categoriesLen := len $.Params.categories }}
|
||||
{{ if gt $categoriesLen 0 }}
|
||||
<span class="middot-divider"></span>
|
||||
<span class="article-categories">
|
||||
<i class="fa fa-folder"></i>
|
||||
{{ range $k, $v := $.Params.categories }}
|
||||
|
@ -30,19 +38,6 @@
|
|||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{ if isset $.Params "tags" }}
|
||||
{{ $tagsLen := len $.Params.tags }}
|
||||
{{ if gt $tagsLen 0 }}
|
||||
<span class="article-tags">
|
||||
<i class="fa fa-tags"></i>
|
||||
{{ range $k, $v := $.Params.tags }}
|
||||
<a href="{{ "/tags/" | relLangURL }}{{ . | urlize | lower }}">{{ . }}</a
|
||||
>{{ if lt $k (sub $tagsLen 1) }}, {{ end }}
|
||||
{{ end }}
|
||||
</span>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{ if ne $is_list 1 }}
|
||||
{{ partial "share.html" $ }}
|
||||
{{ end }}
|
||||
|
|
|
@ -516,11 +516,14 @@ article {
|
|||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
.article-metadata .article-date,
|
||||
.article-metadata .article-reading-time,
|
||||
.article-metadata .article-categories,
|
||||
.article-metadata .article-tags {
|
||||
margin-right: 10px;
|
||||
.middot-divider {
|
||||
padding-right: .45em;
|
||||
padding-left: .45em;
|
||||
font-size: 15px;
|
||||
}
|
||||
|
||||
.middot-divider::after {
|
||||
content: '\00B7';
|
||||
}
|
||||
|
||||
.article-style img,
|
||||
|
@ -544,6 +547,20 @@ article {
|
|||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.article-widget {
|
||||
padding-top: 1rem;
|
||||
}
|
||||
|
||||
.article-widget h3 {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.hr-light {
|
||||
border-top: 1px solid rgba(0,0,0,.05);
|
||||
margin-top: 0.5rem;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
#comments {
|
||||
padding-top: 1rem;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,10 @@
|
|||
{{ $js := .Site.Data.sri.js }}
|
||||
|
||||
{{ $comments_enabled := and $.Site.DisqusShortname (not (or $.Site.Params.disable_comments $.Params.disable_comments)) }}
|
||||
{{ if and $comments_enabled ($.Site.Params.comment_count | default true) }}
|
||||
<script id="dsq-count-scr" src="//{{ .Site.DisqusShortname }}.disqus.com/count.js" async></script>
|
||||
{{ end }}
|
||||
|
||||
{{ if not .Site.Params.disable_sri }}
|
||||
{{ printf "<script src=\"https://cdnjs.cloudflare.com/ajax/libs/jquery/%s/jquery.min.js\" integrity=\"%s\" crossorigin=\"anonymous\"></script>" $js.jQuery.version $js.jQuery.sri | safeHTML }}
|
||||
{{ printf "<script src=\"https://cdnjs.cloudflare.com/ajax/libs/jquery.imagesloaded/%s/imagesloaded.pkgd.min.js\" integrity=\"%s\" crossorigin=\"anonymous\"></script>" $js.imagesLoaded.version $js.imagesLoaded.sri | safeHTML }}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue