Overview
Spree generates SEO-friendly URL slugs for resources like products, taxons, and stores. Instead of accessing resources by ID, you can use clean, readable URLs based on resource names. Both the Store API and Admin API accept slugs or IDs interchangeably for resource lookups.Slug Generation
Slugs are automatically generated from resource names:| Input | Generated Slug |
|---|---|
Spree T-Shirt | spree-t-shirt |
Café & Restaurant | cafe-and-restaurant |
Summer Collection 2025 | summer-collection-2025 |
Models with Slugs
| Resource | Slug Column | Translatable | Hierarchical |
|---|---|---|---|
| Product | slug | Yes | No |
| Taxon | permalink | Yes | Yes |
| Store | code | No | No |
| Post | slug | Yes | No |
Taxon Permalinks
Taxon slugs include the full parent path, making them hierarchical:Slug History
When a slug changes (e.g., a product is renamed), Spree preserves the old slug. Requests using old slugs still find the resource, enabling:- SEO continuity — no broken links when names change
- Bookmark compatibility — saved URLs keep working
- Graceful URL migration — old links resolve automatically
Internationalization
Products, taxons, and posts support localized slugs — a different slug per locale:Reserved Words
Spree prevents certain words from being used as slugs to avoid route conflicts:new, edit, index, login, logout, admin, and others.
Related Documentation
- Products — Product catalog
- Translations — Multi-language content
- Querying — API resource lookup

