Skela

Template Functions

List of available Go template functions

Template Functions

Skela extends the Pongo2 engine with several useful functions.

# String Manipulation

# upper

Converts a string to uppercase.

{{ upper("hello") }} // HELLO

# lower

Converts a string to lowercase.

{{ lower("HELLO") }} // hello

# replace

Replaces all occurrences of a substring. Signature: replace(input, old, new)

{{ replace("hello world", "world", "skela") }} // hello skela

# split

Splits a string into a slice. Signature: split(input, separator)

{{ split("a,b,c", ",") }} // [a b c]

# Checks

# contains

Checks if a string contains a substring. Signature: contains(input, substring)

{% if contains(name, "api") %}...{% endif %}

# hasPrefix

Checks if a string starts with a prefix. Signature: hasPrefix(input, prefix)

{{ hasPrefix("main.go", "main") }} // true

# hasSuffix

Checks if a string ends with a suffix. Signature: hasSuffix(input, suffix)

{{ hasSuffix("index.js", ".js") }} // true