Skip to Content

Give a HubSpot custom module a unique ID

⚠️ Note that this post hasn't been updated for at least a year and the information may be outdated, proceed with caution! (Last updated: March 12, 2020)

Sometimes you may want to use a unique ID for a custom module. You can create an ID using the following HubL snippet: 

{% raw %}{% set mid = module | pprint | md5 %}

Then you can use that ID to create a unique CSS ID, for example: 

<div id="section-{{ mid }}">
  My DIV

which will print out something like: 

<div id="section-6219837888e9769f1d695d05b73a8256">
  My DIV

←  Previous Article

Get HubSpot cookie (hubspotutk) using JavaScript

Next Article  →

Update a nested/grouped field on a HubSpot custom module (HubL module or dnd_module)


Get help from a HubSpot CMS Expert

  • Custom HubSpot themes and reusable and easy-to-use HubSpot templates and modules
  • Technical support and guidance on the HubSpot CMS