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

How to enable Disqus comments #4

Open
wants to merge 1 commit into
base: master
from

Conversation

3 participants
@yihui
Copy link
Owner

yihui commented Jun 20, 2017

Add {{ template "_internal/disqus.html" . }} to foot_custom.html, and configure the Disqus shortname in config.toml.

Preview: https://deploy-preview-4--hugo-xmin.netlify.com/

@yihui yihui added the feature label Jun 22, 2017

@yihui yihui force-pushed the feature/disqus branch 2 times, most recently from 295102e to 8452188 Jun 30, 2017

@yihui yihui force-pushed the feature/disqus branch 3 times, most recently from daff20e to bb60546 Jul 9, 2017

@histrio

This comment has been minimized.

Copy link

histrio commented Aug 14, 2017

This will lead to comments block appearing on the main page also.

@yihui yihui force-pushed the feature/disqus branch from bb60546 to 787685c Aug 14, 2017

@yihui

This comment has been minimized.

Copy link
Owner

yihui commented Aug 14, 2017

Yes, and you can load comments conditionally, e.g. https://github.com/yihui/hugo-lithium-theme/blob/master/layouts/partials/disqus.html#L1 Use a parameter disable_comments: false in the YAML metadata of a post to disable comments for a specific post.

@histrio

This comment has been minimized.

Copy link

histrio commented Aug 15, 2017

Thanks, yihui
How can I disable comments on the main page (list.html) then?

@yihui

This comment has been minimized.

Copy link
Owner

yihui commented Aug 15, 2017

@histrio Please see https://gohugo.io/variables/page/ for more available variables that you can use.

@oneleaftea

This comment has been minimized.

Copy link
Contributor

oneleaftea commented Aug 24, 2017

@histrio easiest way is to simply add it to the single.html template above the footer instead of the footer template itself. Then it won't show up on the main page or list pages.

@histrio

This comment has been minimized.

Copy link

histrio commented Aug 25, 2017

@oneleaftea I resolve it like this

{{ if .IsPage }}
  {{ template "_internal/disqus.html" . }}
{{ end }}

in layouts/partials/foot_custom.html

@yihui yihui force-pushed the feature/disqus branch from 787685c to 9c84bb0 Aug 29, 2017

@yihui yihui force-pushed the feature/disqus branch from 9c84bb0 to 6ca35c9 Oct 8, 2017

@yihui yihui force-pushed the feature/disqus branch from 6ca35c9 to 6a98df5 Oct 27, 2017

@yihui yihui force-pushed the feature/disqus branch from 6a98df5 to 68a839e Mar 21, 2018

@yihui yihui force-pushed the feature/disqus branch from 68a839e to d632c7b Aug 30, 2018

@yihui yihui force-pushed the feature/disqus branch from d632c7b to 0805ade Oct 1, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment