---
title: Advanced Paths
description: The Advanced Paths app builds programmable preview paths for folders and stories using Squirrelly templates.
url: https://www.storyblok.com/docs/apps/advanced-paths
---

# Advanced Paths

The Advanced Paths app builds the preview path (the real path) of a folder or story from a [Squirrelly v8](https://squirrelly.js.org/) 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.

## Features

-   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.

## Setup

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.

## Template variables

Write the preview path with the [Squirrelly v8 syntax](https://squirrelly.js.org/docs/syntax/cheatsheet). 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](/docs/concepts/internationalization#field-level-translation). |
| `it.branch_id` | The current branch ID when using the [Pipelines app](/docs/apps/pipelines). |
| `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](/docs/concepts/internationalization#build-paths-from-translated-slugs). |

## Examples

Use a different domain when the language is German:

```plaintext
{{@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`:

```plaintext
{{@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:

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

## Further resources

[Set an advanced path based on translated slugs](/docs/concepts/internationalization#build-paths-from-translated-slugs)

[Advanced Paths in the app directory](https://www.storyblok.com/apps/advanced-paths)

## Pagination

-   [Previous: Activities](/docs/apps/activities)
-   [Next: AI SEO](/docs/apps/ai-seo)
