Slugs & SEO
Quark Commerce provides a centralized slug system for SEO-friendly URLs. Slugs are multi-language — each entity can have a different slug per language.
How Slug Resolution Works
Resolve a Slug
GET /api/storefront/slugs/{slug}
Response:
{
"entityType": "Product",
"entityId": "guid"
}
Possible entityType values:
| Entity Type | Route to |
|---|---|
Product | Product detail page |
ProductVariant | Product detail page with variant pre-selected |
Category | Category listing page |
Direct Slug Support in Endpoints
Several endpoints accept either a GUID or slug directly:
GET /api/storefront/products/{idOrSlug}
GET /api/storefront/categories/{idOrSlug}
The API automatically detects whether the parameter is a GUID or slug and resolves accordingly.
Multi-Language Slugs
The same product can have different slugs per language:
| Language | Slug | URL |
|---|---|---|
| English | classic-t-shirt-white | /classic-t-shirt-white |
| Turkish | klasik-tisort-beyaz | /klasik-tisort-beyaz |
Both resolve to the same product/variant. The slug resolution is language-agnostic — any valid slug will resolve regardless of the current X-Language-Code.
Building a Slug Router
For a single-page application, implement a catch-all route that resolves slugs:
// Example: Slug router (adapt to your framework)
{ path: ':slug', component: SlugResolverComponent }
// In the resolver:
async resolve(slug: string) {
const result = await this.slugService.resolve(slug);
switch (result.entityType) {
case 'Product':
case 'ProductVariant':
this.router.navigate(['/product', slug]);
break;
case 'Category':
this.router.navigate(['/c', slug]);
break;
default:
this.router.navigate(['/404']);
}
}
SEO Best Practices
- Use slugs in all customer-facing URLs (not GUIDs)
- Set canonical URLs using the slug for the current language
- Include
hreflangtags for multi-language pages pointing to each language's slug - The slug resolution endpoint is lightweight and cached — safe to call on every page load