Metadata
Learn how to customize metadata for your MkSaaS website
This guide covers the metadata system in your MkSaaS website, how to customize SEO-related information, and how to configure social sharing metadata for optimal visibility.
Core Features
The MkSaaS template comes with a robust metadata system that provides:
- SEO-optimized page titles and descriptions
- Social media sharing metadata (Open Graph and Twitter)
- Favicon and app icons
- Custom image support for social sharing
- Internationalization support for metadata
Understanding the Metadata System
The metadata system in MkSaaS is built on Next.js metadata API and is configured through several key files:
1. Centralized Configuration
The main website configuration is defined in src/config/website.tsx
:
This configuration defines:
- Default theme and dark mode settings
- Logo and Open Graph image paths
- Social media links
2. Translation Files
The basic website metadata such as name, title, and description are defined in the translation files:
3. Metadata Construction
The constructMetadata
function in src/lib/metadata.ts
handles creating the metadata object for each page:
This function handles:
- Setting default values from translations
- Configuring Open Graph and Twitter card metadata
- Setting up favicon and icon information
- Managing canonical URLs and robots directives
Customizing Website Metadata
Basic Website Information
To change the basic website information like name, title, and description:
- Edit the
messages/en.json
file (and other language files if you're using them):
For multilingual sites, update each language file with appropriate translations:
Customizing Social Images
To change the Open Graph image and logos:
- Place your image files in the
public
directory - Update the paths in
src/config/website.tsx
:
Recommended dimensions:
- OG Image: 1200×630 pixels for optimal display on social platforms
- Logo: At least 512×512 pixels for high-resolution displays
Social Media Links
Update your social media links in the website configuration:
Favicons and App Icons
To replace the default favicons and app icons:
- Generate a complete set of icons using a tool like Real Favicon Generator
- Place the generated files in the
public
directory - Update the paths in the
constructMetadata
function if necessary:
Canonical URLs
For pages with multiple URLs or to prevent duplicate content issues, set canonical URLs:
No-Index Pages
For pages you don't want indexed by search engines:
For a complete PWA experience, also update the manifest.webmanifest
file in the public directory.
Page-Specific Metadata
Adding Metadata to MDX Pages
In your MDX content pages, you can define metadata in the frontmatter:
The metadata system will automatically use these values when rendering the page.
Programmatic Metadata
For React pages, you can use the constructMetadata
function:
Custom Open Graph Data
For pages that need specific Open Graph data:
Best Practices
- Keep Titles Concise: Aim for titles under 60 characters for optimal display in search results
- Descriptive Meta Descriptions: Write compelling descriptions of 150-160 characters
- Unique Content: Ensure each page has unique title and description
- Use High-Quality Images: Create professional, relevant images for OG and Twitter cards
- Test Social Sharing: Use tools like Twitter Card Validator and Facebook Sharing Debugger
- Include Keywords: Incorporate relevant keywords naturally in titles and descriptions
- Update Consistently: Keep metadata current with your content changes
- Mobile Optimization: Ensure your metadata looks good on mobile devices
- Language-Specific Content: Use appropriate language tags for international content
Next Steps
Now that you understand how to customize metadata in MkSaaS, explore these related topics: