site
The site object is accessible everywhere. The site object has the following default attributes, but is also extendible by addingĀ content fields.
site.name
Returns the site name
site.site_id
Returns the siteās id
site.domain
Returns the siteās primary full domain. E.g.Ā www.my-plate-site.com.
site.attachments
Returns all attachments in a collection.
site.content_objects.[:plural_content_type_name]
Returns allĀ Abstract Content ObjectsĀ for the given content type name in a collection.
E.g., when you have a content type with the (plural) name 'categories', site.content_objects.categories
returns a collection object with all categories in it.
site.elements.[:plural_content_type_name]
Returns allĀ Elements for the given content type name in a collection.
E.g., when you have a content type with the (plural) name āforms', site.elements.forms
returns a collection object with all 'Formā elements in it.
You can also get all elements of a site in a collection: site.elements.all
site.trays
Returns all trays from a site.
site.[:plural_post_type_name]
Returns a collection with all posts (objects with the specifiedĀ post type). E.g.Ā {{ site.pages }}
Ā returns a collection with all posts with the content type āpageā.
site.post_types
Returns an array of liquid drops from all post_types in a site.
You can also loop through the array as follows:
{% for post_type in site.post_types %}
{{post_type.title}}
{% endfor %}
site.element_types
Returns all element types of a site.
site.section_types
Returns all section types of a site.
site.abstract_content_types
Returns all abstract content types of a site.
site.content_types
Returns all content types from a site.
site.languages
Returns an array of objects representing the available languages for the site.
Input:
{{ site.languages }}
Output:
[
{ "shortcode" => "nl", "name" => "Dutch, "url" => "/dutch-url" },
{ "shortcode" => "en", "name" => "English, "url" => "/en/english-url" },
{ "shortcode" => "de", "name" => "German, "url" => "/de/german-url" }
]
The url attribute returns the url of the translation for the Post you are on. If there is no translation found, the root url for the language is returned. E.g. ā/enā for English, ā/frā for French, and so on.
Input:
Output: