2

I am running an open source comment engine on my server which I want to integrate to my Hugo site.

After doing all the listed things below, the comment section is not visible, and only the heading appears.

What are the possible reasons for this and error and how can I solve it?

So I created a partials file for It, added some code in single.hmtl and edited my config.toml correspondingly.

This is what's inside my partial file named commento.html:

<div id="commento"></div>
<script defer src="{{ .Site.Params.CommentoURL }}/js/commento.js"></script>
<noscript>Please enable JavaScript to load the comments.</noscript>

This is what's inside my single.html file:

{{ if and .Site.Params.CommentoURL (and (not .Site.BuildDrafts) (not .Site.IsServer)) -}}
<h2>Comments</h2>
{{ partial "commento.html" . }}
{{- end }}

and I added the commentoURL parameter in config.toml file like this:

CommentoURL = "http://qwerty.abc:8080"

1 Answers1

1

Please Inspect the output HTML. I am pretty sure you will find this empty div:

<div id="commento"></div>

This means that your Javascript is broken. This has nothing to do with Hugo, partials or even Hugo themes. You probably also have a red error in your Javascript console. This is what you should focus on.

Mr. Hugo
  • 11,887
  • 3
  • 42
  • 60
  • Alright Make sense. Yes, I do have these following errors upon inspection: 1. Blocked loading mixed active content “http://commento.qwerty.xyz:8080/js/commento.js” 2. Loading failed for the – dummytokken Feb 20 '23 at 08:55
  • 1
    Close this question and open a new one ;-). No... seriously... don't hijack this question for a completely different one (a Javascript issue). Please, describe your Javascript error as good as possible in a new question. That is how Stack Overflow works. – Mr. Hugo Feb 20 '23 at 08:59
  • Ok. My bad. Will open a new one. – dummytokken Feb 20 '23 at 09:03
  • 1
    You will find some great Javascript experts when you tag it correctly. Just like you did with Hugo ;-). Good luck! – Mr. Hugo Feb 20 '23 at 09:07
  • Thanks! Any suggestions for the tag? The obvious one is javascript but what else? – dummytokken Feb 20 '23 at 09:17
  • I would do javascript and errors, similar to this one: https://stackoverflow.com/questions/20605423/blocked-loading-mixed-active-content – Mr. Hugo Feb 20 '23 at 09:21