From e2ca0c5332668ba031015dae977f7816b2809f06 Mon Sep 17 00:00:00 2001 From: leafee98 Date: Wed, 18 May 2022 21:13:49 +0800 Subject: [PATCH] toggle comments at front matter Whether the comment show up was determined by if the page is under mainSection, now it's determined by front matter and config.toml --- exampleSite/archetypes/default.md | 2 ++ layouts/_default/single.html | 3 +-- layouts/partials/head.html | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/exampleSite/archetypes/default.md b/exampleSite/archetypes/default.md index 8882e0b..64808c8 100644 --- a/exampleSite/archetypes/default.md +++ b/exampleSite/archetypes/default.md @@ -3,6 +3,8 @@ title: "{{ replace .Name "-" " " | title }}" date: {{ .Date }} tags: [] categories: [] +weight: 50 +show_comments: true draft: true --- diff --git a/layouts/_default/single.html b/layouts/_default/single.html index fe05600..b951cb7 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -39,9 +39,8 @@ {{ .Content }} - {{ if in .Site.Params.mainSections .Type }} + {{ with and .Site.Params.remark42 .Params.show_comments }}
- {{ partial "comment.html" . }} {{ end }} diff --git a/layouts/partials/head.html b/layouts/partials/head.html index b1f80cd..adca496 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -11,7 +11,7 @@ {{ end }} -{{ with .Site.Params.remark42 }} +{{ with and .Site.Params.remark42 .Params.show_comments }}