From 098179ec1ffd0bd9408d145123f0338346e9fa28 Mon Sep 17 00:00:00 2001 From: Emily <734204679@qq.com> Date: Thu, 28 Oct 2021 23:11:25 +0800 Subject: [PATCH] Add valine comment system support (#446) * feat: add valine support * Adjust the comment config * Adjust the comment config * Make comment section backward compatible with old config Signed-off-by: hossainemruz Co-authored-by: hossainemruz --- layouts/_default/single.html | 20 +++++++++++++++++--- layouts/partials/disqus.html | 7 ++++++- layouts/partials/valine.html | 17 +++++++++++++++++ 3 files changed, 40 insertions(+), 4 deletions(-) create mode 100644 layouts/partials/valine.html diff --git a/layouts/_default/single.html b/layouts/_default/single.html index 3bd38b5..2423a98 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -155,10 +155,24 @@
{{ partial "navigators/next-prev-navigator.html" . }}
- - {{ if site.DisqusShortname }} - {{ partial "disqus.html" . }} + + + {{ with site.Params.features.comment }} + {{ if .enable }} + + {{ if .disqus.shortName }} + {{ partial "disqus.html" . }} + + {{ else if .valine }} + {{ partial "valine.html" . }} + {{ end }} + {{ end }} {{ end }} + + {{ if site.DisqusShortname }} + {{ partial "disqus.html" . }} + {{ end }} + diff --git a/layouts/partials/disqus.html b/layouts/partials/disqus.html index 71fef21..4ccd9e2 100644 --- a/layouts/partials/disqus.html +++ b/layouts/partials/disqus.html @@ -1,3 +1,8 @@ +{{ $disqusShortName := site.DisqusShortname }} +{{ if site.Params.features.disqus.shortName }} + {{ $disqusShortName = site.Params.features.disqus.shortName }} +{{ end }} +
+ +