# Pathfinder: How to use URL Strategy setting

The Pathfinder section allows you to control how button links are generated based on user selections. This guide explains each URL strategy and how to configure them.

### URL Strategy Options

#### 1. Collection Handle (Default)

**What it does:** Combines all selected option IDs into a single collection handle, separated by hyphens.

**Configuration:**

* **URL Strategy:** Select "Collection handle"
* **Collection Base URL:** Enter the base path (default: `/collections`)

**How it works:**

* Selected options: `women` → `tops` → `black`
* Generated URL: `/collections/women-tops-black`

**Best for:**

* Stores with a structured collection naming system
* Multi-level collection hierarchies
* When you have pre-created collections for each combination

**Example setup:**

```
Collection Base URL: /collections
Option IDs: women, tops, black
Result: /collections/women-tops-black
```

***

#### 2. Search Query

**What it does:** Creates a product search URL using the option names as search terms.

**Configuration:**

* **URL Strategy:** Select "Search query"
* No additional settings required

**How it works:**

* Selected options: `Women` → `Tops` → `Black`
* Generated URL: `/search?q=Women+Tops+Black&type=product`

**Best for:**

* Stores without pre-structured collections
* When you want to search across all products
* Dynamic filtering based on product titles/descriptions

**Example:**

```
Option Names: Women, Tops, Black
Result: /search?q=Women%20Tops%20Black&type=product
```

***

#### 3. Tagged Collection

**What it does:** Links to a base collection filtered by product tags.

**Configuration:**

* **URL Strategy:** Select "Tagged collection"
* **Base Collection Handle:** Enter the main collection to filter (default: `all`)

**How it works:**

* Selected options: `women` → `tops` → `black`
* Generated URL: `/collections/all/women+tops+black`

**Best for:**

* Filtering a single large collection by tags
* Using Shopify's native tag filtering
* When all products are tagged consistently

**Example setup:**

```
Base Collection Handle: all-products
Option IDs: women, tops, black
Result: /collections/all-products/women+tops+black
```

***

#### 4. Custom Pattern

**What it does:** Allows you to define your own URL structure using placeholders.

**Configuration:**

* **URL Strategy:** Select "Custom pattern"
* **Custom URL Pattern:** Enter your pattern with placeholders

**Available placeholders:**

* `{1}`, `{2}`, `{3}` - Option IDs by position
* `{layer1}`, `{layer2}`, `{layer3}` - Option IDs by layer name
* `{name1}`, `{name2}`, `{name3}` - Option names (URL encoded)

**How it works:**

* Pattern: `/products/{layer1}?category={layer2}&color={layer3}`
* Selected: `women` → `tops` → `black`
* Generated: `/products/women?category=tops&color=black`

**Best for:**

* Custom page structures
* Advanced URL parameters
* Integration with custom apps or filters
* Non-standard routing

**Examples:**

**Product page with variants:**

```
Pattern: /products/{1}?variant={2}&color={3}
Result: /products/women?variant=tops&color=black
```

**Custom pages:**

```
Pattern: /pages/{layer1}-{layer2}-collection
Result: /pages/women-tops-collection
```

**Query parameters:**

```
Pattern: /collections/all?gender={1}&type={2}&color={3}
Result: /collections/all?gender=women&type=tops&color=black
```

**Mixed structure:**

```
Pattern: /shop/{name1}/{layer2}?filter={layer3}
Result: /shop/Women/tops?filter=black
```

***

### Setup Workflow

#### Step 1: Choose Your Strategy

Consider your store structure:

* **Pre-built collections?** → Use "Collection handle"
* **Tag-based filtering?** → Use "Tagged collection"
* **Simple search?** → Use "Search query"
* **Custom needs?** → Use "Custom pattern"

#### Step 2: Configure Settings

Based on your chosen strategy, fill in the required fields in the section settings under "🔗 URL Strategy"

#### Step 3: Set Option IDs

For each option in your pathfinder layers:

1. Go to the option block settings
2. Set the **Option ID** field (e.g., `women`, `tops`, `black`)
3. Use lowercase, no spaces (use hyphens if needed)
4. Keep them consistent with your collections/tags

#### Step 4: Test Your URLs

1. Preview the section
2. Make selections through all layers
3. Check the generated button URLs
4. Verify they point to the correct pages

***

### Common Use Cases

#### Fashion Store with Collections

```
Strategy: Collection Handle
Base URL: /collections
Layers: Gender → Category → Color
Option IDs: women, tops, black
Result: /collections/women-tops-black
```

#### General Store with Search

```
Strategy: Search Query
Layers: Category → Feature → Price Range
Option Names: Kitchen, Non-Stick, Under $50
Result: /search?q=Kitchen+Non-Stick+Under+$50&type=product
```

#### Tagged Product Catalog

```
Strategy: Tagged Collection
Base Collection: all-products
Layers: Room → Style → Color
Option IDs: bedroom, modern, blue
Result: /collections/all-products/bedroom+modern+blue
```

#### Custom Implementation

```
Strategy: Custom Pattern
Pattern: /collections/{1}?filter.v.option.{2}={3}
Layers: Collection → Option Name → Value
Result: /collections/clothing?filter.v.option.size=large
```

***

### Tips & Best Practices

1. **Keep IDs consistent:** Use the same naming convention across collections, tags, and option IDs
2. **Test thoroughly:** Verify URLs work before publishing
3. **Use lowercase:** Avoid issues with case-sensitive URLs
4. **No special characters:** Stick to letters, numbers, and hyphens in option IDs
5. **Plan ahead:** Map out your URL structure before setting up the pathfinder
6. **Document your pattern:** If using custom patterns, keep notes on the structure

***

### Troubleshooting

**URLs not working?**

* Check that option IDs match your collection/tag handles exactly
* Verify collections exist in your store
* Test URLs manually in the browser

**Wrong pages loading?**

* Review option ID spelling and case
* Confirm collection base URL is correct
* Check that tags are applied to products

**Custom pattern not generating?**

* Ensure placeholders are correct (`{1}`, `{layer1}`, etc.)
* Verify pattern syntax (no typos in curly braces)
* Test with simpler patterns first
