Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleaner and more specific way to implement comment section for posts #39

Open
wants to merge 2 commits into
base: feature/disqus
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion exampleSite/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ languageCode = "en-us"
title = "A minimal Hugo website"
theme = "hugo-xmin"
googleAnalytics = ""
disqusShortname = ""
disqusShortname = "yihui"
ignoreFiles = ["\\.Rmd$", "\\.Rmarkdown$", "_files$", "_cache$"]
footnotereturnlinkcontents = "↩"

Expand Down Expand Up @@ -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
14 changes: 14 additions & 0 deletions layouts/post/single.html
Original file line number Diff line number Diff line change
@@ -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" . }}