Can I auto generate unique ID of each post card?

Hi, I need input and the label for it in each postcard on the home page. I wish if Hugo auto-generate it.
Suppose I need several divs like:

<div class="post-card">
  <div><label for="AUTO_GENERATED_ID"></label></div>
  <div><input type="checkbox" id="AUTO_GENERATED_ID"></div>

I tried to do it like truncuating title of post.

<div class="post-card">
  <div><label for="{{.Title | truncate 5 }}"></label></div>
  <div><input type="checkbox" id="{{.Title | truncate 5 }}"></div>

But I’m not satisfied with that method. Can you guys help me? Note: I need that piece of string twice i.e. for both label and input.

You can use .UniqueId

the MD5-checksum of the content file’s path.


Thanks. Meantime I found another hack like {{ .Permalink | path.Base }}. But .UniqueId is better one.

Just in case anyone else stumbles here.

This variable is deprecated and will be removed, use .File.UniqueID instead.