@website global variable
Every website contains some useful data under the @website global variable.
- @website.url - site URL (it can contain index.html at the end in some cases - such as during website settings or in preview mode),
- @website.baseUrl - site URL without index.html at the end
- @website.rootUrl - alias for @website.baseUrl,
- @website.tagsUrl - URL for the page with all tags,
- @website.searchUrl - URL for the search page,
- @website.errorUrl - URL for the error page,
- @website.assetsUrl - URL for the assets directory of the theme (assets directory is defined in the theme config.json file),
- @website.mediaFilesUrl - URL to the /media/files/ directory,
- @website.pageUrl - URL of the currently displayed page,
- @website.name - site name,
- @website.logo - site logo (alias for @config.basic.logo),
- @website.logoSize - object with size of the logo in pixels - you can access width via @website.logoSize.width and height via @website.logoSize.height
- @website.lastUpdate - timestamp of the last website render,
- @website.contentStructure - object with structure of the website content (explained below),
- @website.language - language code of the website language based on the website settings. Can be used in the lang attributes.
- @website.postsOrdering - ordering of the posts on the listings (returned values: asc or desc), can be used for proper handling of the pagination ordering.
Content structure
The @website.contentStructure global variable contains the following object:
{
posts: [post item],
pages: [page item],
pagesStructure: {
page ID: [subpage ID1, subpage ID2 ...]
},
tags: [{
tag item
posts: [the same structure as in the posts above]
}],
authors: [{
author item
posts: [the same structure as in the posts above]
}]
}
This is useful if you want to generate some parts of your website automatically such as the main menu structure which are updated with new posts/tags/authors.