Clean URLs are not just cosmetic — they improve SEO, user trust, and long-term maintainability of your website. In SDP, you also get powerful dynamic routing using Laravel-style variables, allowing you to build flexible page structures without duplicating content.
Here’s how to do it the right way.
URL Slug Best Practices
A good slug should be:
- Short
- Descriptive
- Lowercase
- Stable over time
✅ Recommended Examples
/about-us /products /products/iphone-15 /services/web-design
❌ Avoid
/AboutUs (mixed case) /my page (spaces) /products/final-v2-new (unstable wording) /p (too vague)
General Slug Rules
Follow these simple standards:
- Use hyphens (-) between words
- Avoid special characters
- Keep nesting intentional (don’t over-complicate URLs)
- Use meaningful words for humans and SEO
- Don’t rename published slugs without planning proper redirects
Your URLs should feel permanent and predictable.
Dynamic Route Variables (Laravel Style)
SDP supports Laravel-style route variables directly inside url_slug. This allows you to create flexible dynamic pages without manually creating every possible URL.
Supported Formats
Required variable
{id}
Optional variable
{category_slug?}
Example Dynamic Slugs
/products/product/{id}
/products/categories/{category_slug?}
How SDP Matches Routes
SDP follows a clear priority order:
- First, it checks for exact slug matches.
- If none are found, it checks slugs with variables.
- If a match is found, URL parameters are extracted and attached to the page.
Example Resolution
Required Variable
Stored slug
/products/product/{id}
Requested URL
/products/product/4
Result
- Page resolves successfully
- Extracted params: id = 4
Optional Variable
Stored slug
/products/categories/{category_slug?}
Examples
/products/categories
→ category_slug = null
/products/categories/shoes
→ category_slug = shoes
Accessing URL Parameters in SDP
Once resolved, URL parameters are available inside:
fields.params url_params
You can use these values in:
- Components
- Templates
- API calls
- Dynamic queries
This allows you to render fully context-specific content from a single page definition.
Recommended Variable Naming
Use meaningful, semantic variable names.
✅ Good
{id}
{product_id}
{category_slug}
{post_slug}
❌ Avoid
{x}
{temp}
{value1}
Clear naming prevents confusion and future conflicts.
Practical Routing Patterns
Here are common real-world use cases:
Product details
/products/{product_slug}
Category listing
/blog/category/{category_slug}
Campaign landing pages
/promo/{campaign_slug}
Optional filter page
/directory/{city_slug?}
Important Notes
- Keep dynamic routes specific to avoid unintended overlap.
- Static routes are always prioritized over dynamic routes.
- If multiple dynamic patterns could match, the most specific pattern should be preferred.
By following these best practices, you’ll keep your URLs clean, predictable, and scalable — while leveraging the full power of dynamic routing inside SDP.