Usage: {{img_url value}}


The img url helper outputs the correctly calculated URL for the provided image property.

You must tell the {{img_url}} helper which image you would like to output.

E.g. if you want to output a url for a post's feature image inside of post.hbs you might use {{img_url feature_image}}.

You can force the image helper to output an absolute url by using the absolute option, E.g. {{img_url profile_image absolute="true"}}. This is almost never needed.

Example code

Below is a set of examples of how you might output various images that belong to posts, authors or keywords:


  <!-- Outputs post's feature image if there is one -->
  {{#if feature_image}}
	<img src="{{img_url feature_image}}">

  <!-- Output post author's profile image as an absolute URL -->
	<img src="{{img_url author.profile_image absolute="true"}}">

  <!-- Open author context instead of providing full path -->
 	   <img src="{{img_url profile_image}}">

  <!-- Loop over tags, and outputs each tag's feature image -->
  {{#foreach tags}}
     <img src="{{img_url feature_image}}" />

  <!-- Check for a primary tag, use a full path to output its feature image -->
  {{#if primary_tag}}
    <img src="{{image_url primary_tag.feature_image}}">

  <!-- Open primary_tag context, instead of using full path -->
    <img src="{{image_url feature_image}}">

		<!-- Go back one level in context, output the POST feature image as well -->
		<img src="{{img_url ../feature_image}}">