razonyang / hugo-theme-bootstrap-comments

1 stars 0 forks source link

en/docs/widgets/comments/ #44

Closed utterances-bot closed 2 years ago

utterances-bot commented 2 years ago

Comments Widget - Hugo Bootstrap

Disqus and Utterances comments widgets are supported out of box. This article shows how to configure them and even customize your own comment widgets.

https://hbs.razonyang.com/en/docs/widgets/comments/

DeMiro5001 commented 2 years ago

Hi, I have installed a remark42 server and I tried to add it to my hugo server. I have added a file "assets/js/remark42.js" containing the script of remark42 (in the setup documentation) I have also added "layouts/partials/post/comments/custom.html" containing the snipet for remark42 (

) But it didn't work as expected. What am I missing ? Thanks

razonyang commented 2 years ago

@jarod5001 You'll need to add the remark42 script to assets/js/custom.js instead of creating a new file assets/js/remark42.js, since the new file assets/js/remark42.js need to be published by Hugo Pipes, for example:

const remark_config = {
    host: 'https://demo.remark42.com',
    site_id: 'remark',
}

!function(e,n){for(var o=0;o<e.length;o++){var r=n.createElement("script"),c=".js",d=n.head||n.body;"noModule"in r?(r.type="module",c=".mjs"):r.async=!0,r.defer=!0,r.src=remark_config.host+"/web/"+e[o]+c,d.appendChild(r)}}(remark_config.components||["embed"],document);

If it doesn't work, please check the output of browser console(F12 in Chrome).