Cleaner and more specific way to implement comment section for posts

This commit is contained in:
Hussain Alsalman 2020-03-18 17:24:50 +03:00
parent 1d034a9c38
commit c341e4690c
3 changed files with 15 additions and 2 deletions

View File

@ -34,3 +34,4 @@ footnotereturnlinkcontents = "↩"
[params]
description = "A website built through Hugo and blogdown."
footer = "© [Yihui Xie](https://yihui.name) 2017 -- 2019 | [Github](https://github.com/yihui) | [Twitter](https://twitter.com/xieyihui)"
enable_comments = true

View File

@ -2,5 +2,3 @@
<script async src="//mathjax.rstudio.com/latest/MathJax.js?config=TeX-MML-AM_CHTML"></script>
<script async src="//yihui.name/js/center-img.js"></script>
{{ template "_internal/disqus.html" . }}

14
layouts/post/single.html Normal file
View File

@ -0,0 +1,14 @@
{{ partial "header.html" . }}
<div class="article-meta">
<h1><span class="title">{{ .Title | markdownify }}</span></h1>
{{ with .Params.author }}<h2 class="author">{{ . }}</h2>{{ end }}
{{ if (gt .Params.date 0) }}<h2 class="date">{{ .Date.Format "2006/01/02" }}</h2>{{ end }}
</div>
<main>
{{ .Content }}
</main>
{{ if .Params.enable_comments }}
{{ template "_internal/disqus.html" . }}
{{ end }}
{{ partial "footer.html" . }}