September 24, 2026

HTL Formatting: URLs, Dates and Numbers

URL formatting

HTL has a rich set of options for manipulating URLs.

<a href="${item.path @ extension = 'html'}">${item.name}</a>

Adds the .html extension to a path.

<a href="${item.path @ extension = 'html', selectors='products'}">${item.name}</a>

Adds the .html extension and a selector to a path.

<a href="${item.path @ extension = 'html', fragment=item.name}">${item.name}</a>

Adds the .html extension and a fragment (#value) to a path.

Date and number formatting

Recent AEM versions format numbers and dates natively, including timezone and locale, so no custom code is needed. The format pattern comes first, followed by the value to format.

Date formatting

<h6>${ 'dd-MMMM-yyyy hh:mm:ss' @ format=currentPage.lastModified, timezone='PST', locale='fr'}</h6>

Number formatting

<h6>${ '#.00' @ format=500}</h6>

Back to the HTL tutorial index