GitHub

{{#is}} helper

The {{#is}} helper is a block helper designed to check if a specific context is loaded.

The argument can be a comma-separated list of context names:

  • index - frontpage,
  • tag - tag listing page,
  • post - single post page,
  • author - author listing page,
  • 404 - 404 error page,
  • search - search results page,
  • pagination - pagination page (tag or frontpage) beginning from second page,
  • index-pagination - pagination frontpage page beginning from second page,
  • tag-pagination - pagination tag page beginning from second page.
  • author-pagination - pagination author page beginning from second page.

Syntax:

{{#is ARGUMENT}}
It is a page of type specified in the argument
{{else}}
It is not a page of type specified in the agrument
{{/is}}

Examples:

{{#is "index"}}

Above code checks if the current page is a frontpage

{{#is "index,tag"}}

In the above code condition is true when current page is a frontpage or a tag page.

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.