The includes
function checks if an array contains a specific value. It is commonly used within conditional logic ({% if %}
) tags.
includes(array, value)
Parameter | Type | Description |
---|---|---|
array | array | Required. The array to check. Often a variable like $frontmatter.tags or an array defined directly. |
value | scalar (string, number, boolean, null) | Required. The value to search for within the array. |
true
if the array
contains the value
, otherwise false
.
---
tags: ["tutorial", "api", "getting-started"]
---
{% if includes($frontmatter.tags, "api") %}
This page is relevant for API users.
{% /if %}
{% if not(includes($frontmatter.tags, "advanced")) %}
This content is suitable for beginners.
{% /if %}
{% if includes($rbac.teams, "employee") %}
You are an employee.
{% /if %}