include is a Liquid tag to include another template into the current one. It is a Liquid built-in tag.
Syntax
{% include "template" [with|for object|collection] %}
include expects at least one parameter, the name of the template to include. This is relative to the templates directory in your theme, so it will always start with "blog/" or "layouts/". The .liquid extension gets added automatically, and an underscore ("_") will be included in front of the filename. So, blog/entry for instance, will be converted into blog/_entry.liquid.
Optionally, a second parameter can be given after the word keyword "with" or "for", which lists one or more variables to be made available in the included template, or a collection (= an array) for which the template will be included for each object. For example, when including 'blog/article' with article: entry, the template blog/_article.liquid will be loaded, and a variable article will be available in it containing the object currently in entry. When including blog/entry for entries, the template blog/_entry.liquid will be loaded for each entry in entries, and a variable entry(?) will be available in it containing the current item of the array.
Examples
{% include "layouts/header" %}
=> Is replaced with the (parsed) contents of
themes/<theme name>/templates/layouts/_header.liquid.
{% include 'blog/article' with id: "7", entry: entry %}
=> Includes the template blog/_article.liquid, where the variable "id" will be
"7" and the variable "entry" will refer to the current variable "entry".
{% for entry in entries %}
{% include 'blog/entry' with entry: entry %}
{% endfor %}
=> Loops through all entries in the variable "entries", and includes the file
blog/_entry.liquid for each one. In blog/_entry.liquid, the variable "entry"
will always refer to the entry we're iterating through at that moment.





