How to convert boolean to integer data?

Hi guys:

Recently I integrate a comment plug-in and found it’s configure use integer data, but actually it’s value just 0 & 1,so that I had idea mabye we can use boolean data in configure file and conver it to integer data in html file, but found all documents not found a way to support it.

e.g :
config.yaml

comment:
  enable: true
  metadata: true

comment.html

<div id="comment" data="{{ .Site.Params.comment.metadata }}"></div>
when it's true want to
<div id="comment" data="1"></div>
else 
<div id="comment" data="0"></div>

Can you give a tip, thanks.

{{ int false }} --> 0
{{ int true }}  --> 1
1 Like

@jmooring Thanks , it’s working well.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.