GitHub

@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.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.pageUrl - URL of the currently displayed page,
  • @website.ampUrl - URL for the AMP version of the page (empty when AMP is disabled),
  • @website.name - site name,
  • @website.logo - site logo (alias for @config.basic.logo),
  • @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.

Content structure

The @website.contentStructure global variable contains the following object:

{
   posts: [post item],
   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.

Subscribe

Get the latest Publii news, updates and more delivered directly to your email inbox

You can change your mind at any time by clicking the unsubscribe link in the footer of any email you receive from us, or by contacting us at contact@tidycustoms.net. By clicking below, you agree that we may process your information in accordance with our Privacy Policy.