Overview
The Pages feature allows administrators to create custom static content pages with unique URLs. Perfect for About, Terms of Service, Privacy Policy, and other standalone pages outside the blog structure.Database Structure
Thepages table provides a simple yet flexible structure:
database/migrations/2025_05_18_185526_create_pages_table.php:14
Page Model
- Title: Display name of the page
- Slug: URL-friendly identifier (e.g.,
about-usbecomes/about-us) - Content: Rich text content for the page body
- Published: Boolean flag to control visibility
app/Models/Page.php:7
User Workflows
Creating a Custom Page
Creating a Custom Page
Page Creation Workflow
-
Access Page Builder
- Navigate to admin panel
- Go to Pages section
-
Enter Page Details
- Title: Enter descriptive page title
- Slug: Create URL-friendly slug (must be unique)
- Example: “About Us” →
about-us - Example: “Privacy Policy” →
privacy-policy
- Example: “About Us” →
- Content: Add page content using rich text editor
-
Set Visibility
- Draft Mode: Leave
publishedasfalse - Public: Set
publishedtotruewhen ready to go live
- Draft Mode: Leave
-
Save Page
- Page becomes accessible at
/{slug} - Only published pages visible to public
- Page becomes accessible at
routes/web.php:119-121Editing a Page
Editing a Page
Edit Workflow
-
Find Page
- View list of all pages in admin panel
- Search by title or slug
-
Update Content
- Modify title, slug, or content
- Change publication status
-
Slug Considerations
- Changing slug will change the URL
- May break existing links
- Consider implementing redirects for old URLs
-
Save Changes
- Updated content immediately reflects on frontend
- Version history not tracked (consider adding revisions)
Publishing and Unpublishing
Publishing and Unpublishing
Publication Controls
Publishing a Page:- Set
publishedtotrue - Page becomes publicly accessible
- Appears in site navigation (if configured)
- Set
publishedtofalse - Page returns 404 to public visitors
- Still accessible in admin panel
- Useful for temporary removal without deletion
- Seasonal content (hide during off-season)
- Work-in-progress pages
- Legal pages requiring updates
Frontend Display
Dynamic Page Routing
Pages are displayed using dynamic slug-based routing:- Published Check: Only shows pages with
published = true - 404 Handling: Returns 404 if page not found or unpublished
- SEO-Friendly URLs: Clean URLs without
/page/prefix
app/Http/Controllers/PageController.php:10
Example URLs
About Page
Slug:
URL:
about-usURL:
https://yoursite.com/about-usDisplays company information, team details, mission statement.Privacy Policy
Slug:
URL:
privacy-policyURL:
https://yoursite.com/privacy-policyDisplays legal privacy information and data handling practices.Terms of Service
Slug:
URL:
terms-of-serviceURL:
https://yoursite.com/terms-of-serviceDisplays user agreement and service terms.Contact
Slug:
URL:
contactURL:
https://yoursite.com/contactContact form and business information.Implementation Notes
Route Constraints
The page route includes a regex constraint:- Lowercase letters (a-z)
- Uppercase letters (A-Z)
- Numbers (0-9)
- Hyphens (-)
- Spaces
- Special characters (@, #, $, etc.)
- Underscores
- Slashes
Best Practices
- SEO Optimization
- Content Management
- Performance
Slug Guidelines:
- Keep slugs short and descriptive
- Use hyphens to separate words
- Avoid numbers unless necessary
- Make slugs permanent (don’t change after publication)
- Use proper heading hierarchy (H1 → H2 → H3)
- Include meta descriptions
- Optimize for keywords
- Add internal links to other pages
Common Use Cases
Static Content
- About Us
- Company History
- Team Bios
- Mission & Values
Legal Pages
- Privacy Policy
- Terms of Service
- Cookie Policy
- Disclaimer
Marketing
- Landing Pages
- Product Features
- Pricing
- Case Studies
Support
- FAQ
- Help Center
- Documentation
- Contact Info
Extending Pages
Adding Custom Fields
Adding Custom Fields
Extend Page Functionality
Add custom fields to pages for enhanced features:1. Create Migration:Page Templates
Page Templates
Multiple Template Support
Implement different layouts for different page types:Controller Logic:default- Standard page layoutwide- Full-width layoutlanding- Marketing landing pagesidebar- Two-column with sidebar
Key Routes
| Method | URI | Action | Description |
|---|---|---|---|
| GET | /{slug} | PageController@show | Display page by slug |
routes/web.php:119-121