Can hugo generate disqus_identifier automatically?

When I using some comment system such as disqus,duoshuo(in china) ,it makes me confuse with disqus_identifier.I think it can automatically generate without setting in front matter. Is there this function or variable in hugo can do it ?
Forgiving my poor english,

Not automatically. You need to set it in your template by doing something like

{{ if .RelPermalink }}
   <script type="text/javascript">
      var disqus_identifier="{{ .RelPermalink }}"
{{ end }}

EDIT: I should add that Hugo ships with a Disqus template. That pulls disqus_identifier from the front matter. If it’s not supplied, then the identifier defaults to .Permalink. You could do something similar with duoshuo, I think;

var disqus_identifier = '{{with .GetParam "disqus_identifier" }}{{ . }}{{ else }}{{ .Permalink }}{{end}}';

Ok,thanks a lot. Let me try it.Now I’m using duoshuo.

Thanks ,It works.

1 Like