Permalinks
Unfold CMS uses a WordPress-style permalink system that lets you customize the URL structure for your content. Permalinks are managed through the admin panel and support date-based, category-based, and simple slug-based patterns.
Configuration
Configure permalink structures in Settings > SEO > Permalinks in the admin panel. You can set the post URL pattern, page URL pattern, and category base prefix.
Available Placeholders
Post Placeholders
| Placeholder | Output | Example |
|---|---|---|
%postname% |
Post slug | getting-started-with-laravel |
%year% |
4-digit year | 2025 |
%monthnum% |
2-digit month | 03 |
%day% |
2-digit day | 15 |
%category% |
Primary category slug | tutorials |
Page Placeholders
| Placeholder | Output | Example |
|---|---|---|
%pagename% |
Page slug | about-us |
Common Structures
Blog Posts
| Structure | Example URL | Description |
|---|---|---|
/blog/%postname%/ |
/blog/my-post/ |
Default — clean and simple |
/%postname%/ |
/my-post/ |
Root-level slugs |
/%year%/%postname%/ |
/2025/my-post/ |
Year-prefixed |
/%year%/%monthnum%/%postname%/ |
/2025/03/my-post/ |
Year + month |
/%year%/%monthnum%/%day%/%postname%/ |
/2025/03/15/my-post/ |
Full date |
/%category%/%postname%/ |
/tutorials/my-post/ |
Category-prefixed |
Pages
| Structure | Example URL |
|---|---|
/page/%pagename%/ |
/page/about/ |
/%pagename%/ |
/about/ |
Categories
Categories use the category base setting:
https://example.com/category/technology
https://example.com/category/tutorials
Slug History & Redirects
When you change a post's slug, Unfold CMS automatically:
- Saves the old slug in the slug history table
- Creates a 301 redirect from the old URL to the new URL
- Preserves any search engine ranking the old URL had
This is powered by the HasSlugHistory trait on the Post model. Old slugs are automatically resolved and redirected.
How It Works
- A visitor requests
/blog/old-post-title/ - The CMS checks if
old-post-titleis a current slug — it's not - The CMS checks the slug history — finds a match pointing to the current post
- Returns a 301 redirect to
/blog/new-post-title/
No manual redirect configuration is needed for slug changes.
Root-Level Slugs
If you use /%postname%/ as your post structure, posts are served at the root level (e.g., /my-post/). The permalink service detects root-level slug patterns and resolves them correctly, distinguishing between posts and pages.
Note: When using root-level slugs, ensure your post slugs don't conflict with system routes like
/admin,/api, or/blog.
How Permalink Resolution Works
The PermalinkService handles URL generation and resolution:
- URL Generation — Converts a post model to its permalink URL based on the configured structure
- Route Pattern Conversion — Translates permalink patterns to Laravel route patterns
- Post Resolution — Given a URL, finds the matching post by slug and verifying date/category components
- Redirect Detection — Checks slug history for moved content
Changing Permalink Structure
You can change the permalink structure at any time through the admin panel. When you change the structure:
- Existing posts immediately use the new URL format
- Old URLs return 404 (unless you set up manual redirects)
- Sitemaps regenerate automatically with the new URLs
Warning: Changing permalink structure on an established site can affect SEO. Consider setting up redirects for your old URL patterns.