Last updated

concat function

The concat function joins multiple arguments together into a single string.

Syntax

concat(arg1, arg2, ..., argN)

Parameters

ParameterTypeDescription
arg1, ..., argNscalar (string, number, boolean, null)Required. One or more values to concatenate. Non-string values are converted to their string representation (e.g., true becomes "true", 123 becomes "123", null becomes "null").

Returns

A single string resulting from the concatenation of all provided arguments.

Examples

Concatenate strings

Full name: {% concat($frontmatter.data.firstName, " ", $frontmatter.data.lastName) %}

Result:
Full name: John Doe

Create dynamic image URLs

{% img src=concat("https://picsum.photos/id/", $frontmatter.data.imageId, "/300/200") /%}

Result:

Create dynamic card title

{% card title=concat("Author", " ", $frontmatter.data.firstName, " ", $frontmatter.data.lastName) %}
  I'm a **card**.
{% /card %}

Result:

Author John Doe

I'm a card.

Resources