Checking Published Status of a Content Item

This section explains how to access and check properties of content items in Parsley, with a focus on the isPublished function to determine if a content item is published.

Checking Publishing Status with isPublished

The isPublished function checks whether a content item, identified by its ZUID, is currently published.

Note: The isPublished function is case-insensitive, allowing variations like isPublished, ISPUBLISHED, or iSPubLiShed.

Syntax

{{ isPublished(content_zuid) }}
  • Parameters:
    • content_zuid: The ZUID of the content item (e.g., 7-e8a990-8b9dvg).
  • Returns:
    • true: The content item is published.
    • false: The content item is unpublished or does not exist.
    • Error message: If the ZUID is missing.

Usage Examples

Check if a content item is published:

{{ isPublished(7-e8a990-8b9dvg) }}

Output: true

Check an unpublished content item:

{{ isPublished(7-f08d8fbbd5-q7c4m5) }}

Output: false

Use any case for the function name:

{{ ISPUBLISHED(7-e8a990-8b9dvg) }}
{{ iSPubLiShed(7-e8a990-8b9dvg) }}

Output: true

Error Cases

The following errors occur when isPublished is used incorrectly:

Empty Parameter

{{ isPublished() }}

Output: Content item ZUID is required.
Cause: The content_zuid parameter is missing.

Unknown or Invalid ZUID

{{ isPublished(7-xyzxyzx-12xyxz) }}

Output: false
Cause: The ZUID does not exist or the item is not published.