Macros

Macros are named placeholders that Latch replaces with context-specific values. They use uppercase snake case surrounded by percent signs:

%MACRO_NAME%

Macros perform direct string substitution. They do not invoke files, query arbitrary settings, or accept parameters. Use a shortcode when output requires those more dynamic behaviors.

Macro names are case-sensitive. %SLUG% is valid where documented, while %slug% is not. The macros available in one setting are not automatically available in another setting.

Unknown macros are left unchanged by the shared replacement helper. Individual settings may apply stricter validation; Permalink Pattern, for example, rejects unsupported macros when the form is saved.

Head Title Format

The Identity -> Head Title Format setting supports:

  • %PAGE_TITLE%: The title of the current page.

Shortcodes are also evaluated in this setting. For example:

[site-title] - %PAGE_TITLE%

Forms with the slugs tag support these macros in their Permalink Pattern:

  • %SLUG%: The slug calculated from the post title or a custom slug supplied by an extension.
  • %FORM%: The slugified form name.

Every non-empty permalink pattern must contain %SLUG%. An empty pattern defaults to %SLUG% for backward compatibility.

Examples:

%SLUG%
documentation/%SLUG%
%FORM%/%SLUG%

The first example produces a root-level path such as /what-is-latch. The second produces /documentation/what-is-latch. The last uses the current form name as its first path segment.

Use a literal segment such as documentation when the public URL should remain unchanged after the form is renamed. Use %FORM% when the URL should intentionally follow the form name.

Patterns are relative paths. Do not include a domain, query string, fragment, or backslash. Latch normalizes each path segment using its standard slug rules.

SQL Object Imports

Exported SQL object packages use these internal import macros:

  • %DB_PREFIX%: The configured Latch database table prefix.
  • %PARENT_ID%: The identifier assigned to the imported parent object.

These placeholders are intended for generated object packages rather than ordinary CMS content.