Skip to content

Custom Templates ​

Haven renders all HTML from Mustache templates. You can override the default templates with your own versions hosted on your server.

How overrides work ​

  1. Host your template files at a public URL
  2. Set templatePath to that base URL
  3. List filenames in userTemplates
  4. Haven checks your path first, then falls back to bundled templates
javascript
haven.config({
  templatePath: 'https://YOUR_TEMPLATE_HOST/haven-templates/',
  userTemplates: [
    'haven-directory-list-item.html',
    'haven-directory-detail.html',
  ],
});

Templates are loaded from:

https://YOUR_TEMPLATE_HOST/haven-templates/haven-directory-list-item.html

Common templates ​

Directory ​

TemplatePurpose
haven-directory-list.htmlList wrapper
haven-directory-list-item.htmlIndividual list item
haven-directory-detail.htmlDetail / lightbox view
haven-directory-itinerary-item.htmlItinerary item
haven-directory-breadcrumb.htmlBreadcrumb trail
haven-directory-filter.htmlFilter wrapper
haven-directory-contactcard-item.htmlContact card item
haven-directory-featured-item.htmlFeatured item

Calendar ​

TemplatePurpose
haven-calendar-list.htmlList wrapper
haven-calendar-list-item.htmlEvent list item
haven-calendar-detail.htmlEvent detail / lightbox
haven-calendar-daily-item.htmlDaily view item
haven-calendar-upcoming-item.htmlUpcoming widget item
haven-calendar-ongoing-item.htmlOngoing event item
haven-calendar-filter.htmlFilter wrapper

Fields ​

TemplatePurpose
haven-field-search.htmlKeyword search input
haven-field-dropdown.htmlType dropdown
haven-field-datepicker.htmlDate picker
haven-field-toggle.htmlToggle filter

Template syntax ​

Templates use Mustache syntax with Haven-provided variables:

html
<article class="haven__item">
  <div class="haven__item__image">
    {{{product_thumbnail}}}
  </div>
  <div class="haven__item__content">
    <h3 class="haven__item__title">
      {{{product_title_linked}}}
    </h3>
    <div class="haven__item__excerpt">
      {{{product_excerpt}}}
    </div>
  </div>
</article>

Variable types ​

SyntaxRendering
{{variable}}HTML-escaped output
{{{variable}}}Unescaped HTML (use for pre-rendered HTML like thumbnails and links)
{{#section}}...{{/section}}Conditional / loop block

Common variables ​

VariableDescription
{{{product_title_linked}}}Linked product title
{{{product_thumbnail}}}Thumbnail image HTML
{{{product_excerpt}}}Short description
{{{product_featured_image}}}Featured image HTML
{{{product_detail_link}}}Detail page link

Starting from defaults ​

Copy the bundled templates from haven-js/dist/template-parts/ as a starting point. Modify markup and classes while keeping the same Mustache variables.

Directory structure on your server ​

haven-templates/
├── haven-directory-list-item.html
├── haven-directory-detail.html
├── haven-calendar-list-item.html
└── haven-calendar-upcoming-item.html

Only list templates you want to override in userTemplates. All other templates use the bundled defaults.

Itinerary vs list item ​

The itinerary template omits product_excerpt compared to the standard list item — it is designed for compact sidebar layouts.

Troubleshooting ​

IssueSolution
Template not loadingVerify URL is publicly accessible (no auth, no CORS block)
Blank itemsCheck Mustache variable names match expected placeholders
Missing detail viewInclude detail template in userTemplates when using lightbox

See Common Issues.

Haven Destinations integration documentation