Introduction to CMS
HubL
The CMS uses a markup language called HubL. Thus, HubL is a markup or templating language. HubL provides standardized access to data without having to use a full-fledged programming language.
HubL is not necessary for basic, out-of-the-box functionality. Yet, HubL is an important part of building custom modules. It is important if you are creating custom templates.
HubL code is written within braces -- { }. HubL has statements, expressions, and comments. Statements do something, like define a variable. Expressions evaluate to a value like outputing a blog author. Comments are for the developer and are not rendered. Macros are similar to functions. Conditional statements use the if / else / endif logic. Loops use the for / endfor snytax.
Examples:
- Statement --
- Expression -- I am a string
- Comment --
- Macro --
- { % macro add_numbers (n1, n2) % }
{ { n1 + n2 } }
{ % endmacro % }
{ { add_numbers (4, 5) } }
- { % macro add_numbers (n1, n2) % }
References:
- HubL Syntax:
https://developers.hubspot.com/docs/cms/hubl - HubDB:
https://developers.hubspot.com/docs/cms/data/hubdb - CMS for Marketers: Certification Course
https://academy.hubspot.com/courses/cms-for-marketers - CMS for Developers: Certification Course
https://academy.hubspot.com/courses/cms-for-developers