Partials

Like most liquid templating environments, you can organize and reuse templates by creating partials. To indicate that a liquid template is a partial, prefix the name with an underscore. This will prevent the file from being rendered as its own html file, and enable it to be used as a partial.

For instance, you could define a file called _video.liquid like this:

{% if video.url != "" %}
  <video title="{{video.name}}" controls>
    <source
      src="{{video.url}}"
      name="{{video.filename}}"
      type="{{video.mime}}">
  </video>
{% endif %}

Then, in a page template you can use this partial:

<h3>{{object.name}}</h3>
{% include 'video' video: object.video %}

Partials may be defined in the pages dir directly or as subpaths (e.g. pages/partials/_video.liquid could be rendered using {% include 'partials/video' video: object.video %})