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

How to add a comment service like the Disqus #133

Closed
noweaver opened this issue Jan 17, 2020 · 6 comments
Closed

How to add a comment service like the Disqus #133

noweaver opened this issue Jan 17, 2020 · 6 comments

Comments

@noweaver
Copy link

Alex,

I added a comment service like the Disqus service in footer.html.

I seemed to be successful in my task but soon disappointed. Even though it is successful in each post, the front page also showed.

https://noweaver.github.io/posts/Misc/2014-03-10_migrate-from-jekyll/#a-practical-example-in-a-diff
This URL is shown correctly. :)

https://noweaver.github.io/
But the main or front-page is not working.

I added the code in footer.html like following as;

<!-- Ryan modified -->
<!--
{{ if (default true (default .Site.Params.BookDisqus .Params.bookDisqus)) }}
 {{ template "_internal/disqus.html" . }} 
{{ end }} 
-->

<br>
<hr color="#D6D6D6" size=0>
<script src="https://utteranc.es/client.js" 
        repo="noweaver/noweaver-comment" 
        issue-term="[##_article_rep_link" 
        theme="github-light" 
        crossorigin="anonymous" 
        async> 
</script>

@alex-shpak
Copy link
Owner

Hi!
There is Disqus support in Hugo, and in theme as well, thanks to PR

To enable set disqusShortname: yourdiscussshortname site variable.

I guess if you want other service, you can replace this line with your template. 🤔 Maybe I should put comments in separate partial.

As for home page, since you have custom template, you will need to add it after this line
https://github.com/noweaver/noweaver/blob/master/layouts/home.html#L19

alex-shpak added a commit that referenced this issue Jan 17, 2020
@alex-shpak
Copy link
Owner

I made some changes to comments, so now you can override layouts/partials/docs/comments.html and put utteranc template there without touching theme.

@noweaver
Copy link
Author

noweaver commented Jan 21, 2020

Alex, Thanx,
'Cause I am a rookie about the static blog, I still don't know your guide.

I just want to show the comment on the only post page except for the front-page.

https://noweaver.github.io/
You can see the Disqus comment service on the front-page. I don't want to show the comment service on the pagination's below of the font-page.

Always thanks

@alex-shpak
Copy link
Owner

Hi!
If you want to have comments only on regular pages do this:

{{ if .Content }}
  {{ "include_your_comments_code_here" }}
{{ end }}

This will render that block only for pages with content.
I'm preparing big update now, that will include that if as well.

@noweaver
Copy link
Author

<!-- This partial can be replaced to support other commenting engines -->
{{ if .Content }}
    {{ template "_internal/disqus.html" . }}
{{ end }}

I solved and thanks

@alex-shpak
Copy link
Owner

Closing then :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants