Skip to content

Advanced Paths

The Advanced Paths app builds the preview path (the real path) of a folder or story from a Squirrelly v8 template rather than a fixed string. Use it when root-level folders point at different preview domains, a language needs its own domain, the URL uses a different separator, or a folder is virtual.

  • Build preview paths from a Squirrelly v8 template.
  • Read the story object, the folder object, the language code, the branch ID, and the environment location and name inside the template.
  • Resolve translated slugs through a helper function.
  • Vary the preview URL per language and per environment.

In the Content section, select a folder or story and open Settings from the toolbar to configure its real path. For a story, the Config section of the Visual Editor offers the same setting.

After installing the app, configure the preview path of each folder.

Write the preview path with the Squirrelly v8 syntax. The template has access to the following variables:

Variable Description
it.story The current story object.
it.folder The current folder object (folders only).
it.lang The code of the selected language when using field-level translation.
it.branch_id The current branch ID when using the Pipelines app.
it.env_location The location of the current preview environment, as defined in Settings → Visual Editor.
it.env_name The name of the current preview environment, as defined in Settings → Visual Editor.
@activeTranslatedSlug A helper that resolves translated slugs. Learn how to set an advanced path based on translated slugs.

Use a different domain when the language is German:

{{@if(it.lang == 'de')}}https://www.yoursite.de/{{#else}}https://www.yoursite.com/{{it.lang}}{{/if}}

Use a custom preview URL when the current preview environment isn’t named Default:

{{@if(it.env_name != 'Default')}}https://www.yoursite.com/{{/if}}

Use the folder slug and append a slash and language code when you select a language:

{{it.folder.slug}}{{ it.lang ? '/' + it.lang : '' }}

Was this page helpful?

What went wrong?

This site uses reCAPTCHA and Google's Privacy Policy (opens in a new window).Terms of Service (opens in a new window) apply.