added option to disable tags in article preview
This commit is contained in:
parent
2535186101
commit
3631685b4d
|
@ -55,6 +55,7 @@ summaryLength = 70 # number of words for article summaries
|
||||||
|
|
||||||
discreteCards = false # enable discrete card style; default false
|
discreteCards = false # enable discrete card style; default false
|
||||||
discreteTags = false # enable discrete tag style; default false
|
discreteTags = false # enable discrete tag style; default false
|
||||||
|
tagsInArticlePreview = true # enable tags list in the article preview card
|
||||||
gridView = false # show post list as a grid. goes well with discreteCards
|
gridView = false # show post list as a grid. goes well with discreteCards
|
||||||
highlightBgColor = "#34363b" # card and circle navigation background color for discrete card mode
|
highlightBgColor = "#34363b" # card and circle navigation background color for discrete card mode
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
<p class="date">
|
<p class="date">
|
||||||
<span title="Date"> </span>
|
<span title="Date"> </span>
|
||||||
{{ .Date.Format "2006-01-02" }}
|
{{ .Date.Format "2006-01-02" }}
|
||||||
{{ if .Params.tags }}
|
{{ if and (site.Params.tagsInArticlePreview | default true) .Params.tags }}
|
||||||
| <!-- Pipe character as visual separator between date and tags-->
|
| <!-- Pipe character as visual separator between date and tags-->
|
||||||
<span title="Tags"> </span>
|
<span title="Tags"> </span>
|
||||||
{{ range .Params.tags }}
|
{{ range .Params.tags }}
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
<p class="date">
|
<p class="date">
|
||||||
<span title="Date"> </span>
|
<span title="Date"> </span>
|
||||||
{{ .Date.Format "2006-01-02" }}
|
{{ .Date.Format "2006-01-02" }}
|
||||||
{{ if .Params.tags }}
|
{{ if and (site.Params.tagsInArticlePreview | default true) .Params.tags }}
|
||||||
<br />
|
<br />
|
||||||
<span title="Tags"> </span>
|
<span title="Tags"> </span>
|
||||||
{{ range .Params.tags }}
|
{{ range .Params.tags }}
|
||||||
|
|
|
@ -1,12 +1,11 @@
|
||||||
<script>
|
<script>
|
||||||
function renderTags(tags) {
|
function renderTags(tags) {
|
||||||
if (tags.length <= 0) return '';
|
if (tags.length <= 0) return '';
|
||||||
let res = '| <span title="tags"> </span>';
|
let res = '| <span title="tags"> </span>';
|
||||||
for (let tag of tags) {
|
for (let tag of tags) {
|
||||||
res += `<a href="/tags/${tag}">#${tag}</a>
|
res += `<a href="/tags/${tag}">#${tag}</a>`;
|
||||||
`;
|
}
|
||||||
}
|
return res;
|
||||||
return res;
|
|
||||||
}
|
}
|
||||||
function renderImage(image) {
|
function renderImage(image) {
|
||||||
if (!image) return '';
|
if (!image) return '';
|
||||||
|
@ -22,7 +21,9 @@
|
||||||
<p class="date">
|
<p class="date">
|
||||||
<span title="Date"> </span>
|
<span title="Date"> </span>
|
||||||
${article.date}
|
${article.date}
|
||||||
${renderTags(article.tags)}
|
{{ if (.Site.Params.tagsInArticlePreview | default true) }}
|
||||||
|
${renderTags(article.tags)}
|
||||||
|
{{ end }}
|
||||||
</p>
|
</p>
|
||||||
{{ if .Site.Params.imageInArticlePreview }}
|
{{ if .Site.Params.imageInArticlePreview }}
|
||||||
${renderImage(article.image)}
|
${renderImage(article.image)}
|
||||||
|
|
Loading…
Reference in New Issue