Custom Pages
Learn how to customize and create new pages in your MkSaaS website
This guide covers the page system in your MkSaaS website, how to customize existing pages, and how to create new pages for your specific needs.
Core Features
The MkSaaS template includes a versatile content management system that allows you to:
- Customize legal pages (Cookie Policy, Privacy Policy, Terms of Service)
- Maintain changelog entries for version releases
- Create marketing and informational pages (About, Contact, Waitlist)
- Add completely custom pages for your specific needs
Page Structure
Pages in MkSaaS are organized into different categories:
Legal Pages
Legal pages are stored in the content/pages
directory and rendered in the src/app/[locale]/(marketing)/(legal)
routes:
- Cookie Policy: Information about how your website uses cookies
- Privacy Policy: Details about how you handle user data
- Terms of Service: Rules and regulations for using your service
Changelog Entries
Release notes are stored in the content/release
directory and displayed on the Changelog page:
- Version Releases: Each release has its own MDX file with version details and changes
Marketing Pages
Marketing pages are rendered in the src/app/[locale]/(marketing)/(pages)
routes:
- About: Information about your company or project
- Contact: Contact forms and information
- Waitlist: Registration for early access or notifications
- Changelog: Page displaying all release notes
Customizing Existing Pages
Legal Pages
Legal pages are written in MDX format and located in the content/pages
directory. Each file includes frontmatter metadata and the content body.
Example: Privacy Policy (privacy-policy.mdx)
To customize a legal page:
- Open the corresponding MDX file in the
content/pages
directory - Update the frontmatter metadata (title, description, date)
- Modify the content in Markdown format
- Save the file
The page will automatically update with your changes.
Changelog Entries
Changelog entries are stored as MDX files in the content/release
directory.
Example: Release v1.0.0 (v1-0-0.mdx)
To add a new release:
- Create a new MDX file in the
content/release
directory (e.g.,v1-1-0.mdx
) - Add the appropriate frontmatter metadata (title, description, date, version, published)
- Write the release notes using Markdown
- Save the file
The new release will automatically appear on your Changelog page, sorted by date (newest first).
Creating New Pages
You can create completely custom pages for your specific needs. There are two approaches:
1. MDX-Based Pages
For content-heavy pages that don't require complex interactivity:
- Create a new MDX file in the
content/pages
directory (e.g.,faq.mdx
) - Add the appropriate frontmatter metadata
- Write your content in Markdown format
- Create a new page component in
src/app/[locale]/(marketing)/(pages)/faq/page.tsx
Here's a template for the page component:
2. Component-Based Pages
For pages that require more complex interactivity:
- Create a new directory in
src/app/[locale]/(marketing)/(pages)
(e.g.,pricing
) - Add a
page.tsx
file that exports your custom page component
Example of a custom page component:
Custom Layouts
You can customize the layout for different page types by modifying the following files:
src/app/[locale]/(marketing)/(legal)/layout.tsx
- For legal pagessrc/app/[locale]/(marketing)/(pages)/layout.tsx
- For marketing pages
These layout files control the container, spacing, and overall structure of the pages.
Page Routes
The page routes are defined in the src/routes.ts
file. The routing system includes several important route categories that control access and navigation in your application:
Protected Routes
Protected routes require user authentication to access. If a user tries to access these routes without being logged in, they will be automatically redirected to the login page. The login page will include a callbackUrl
parameter to redirect the user back to their intended destination after successful authentication.
Routes Not Allowed for Logged-in Users
These routes are specifically blocked for users who are already logged in. When an authenticated user tries to access these routes, they will be automatically redirected to the default login redirect page (typically the dashboard).
Default Login Redirect
This route defines where users are redirected after successful login if no specific callbackUrl
is provided. By default, it redirects to the dashboard, but this can be configured in your website configuration:
SEO Optimization
MkSaaS includes built-in SEO features for pages:
- Each page generates appropriate metadata using the
generateMetadata
function - Canonical URLs are automatically created
- Page titles and descriptions are used for SEO metadata
Best Practices
- Keep Content Updated: Regularly review and update your legal pages and documentation
- Use Clear Structure: Organize content with proper headings and sections
- Include Metadata: Always provide accurate title, description, and date in frontmatter
- Optimize Images: If including images in MDX content, optimize them for web
- Test Translations: If supporting multiple languages, test all translations
- Mobile Responsiveness: Ensure all pages are fully responsive on mobile devices
Next Steps
Now that you understand how to work with pages in MkSaaS, explore these related topics: