SEO
Best practices and implementation guidance for optimizing your application for search engines.
MuseMVP includes a complete SEO foundation, covering sitemap, robots, page metadata, and Open Graph configuration. This guide introduces where each part is implemented and how to customize it.
SEO Capabilities Overview
Sitemap
Automatically generates sitemap.xml, including multilingual URLs for home, marketing pages, blog, docs, and legal pages.
Robots
Allows all crawlers by default; rules can be adjusted in robots.ts as needed.
Metadata
Each page uses generateMetadata for title, description, Open Graph, and more.
Multilingual
Both sitemap and metadata support i18n, generating locale-specific URLs and copy.
Core Implementation
sitemap.xml
sitemap.ts aggregates the following page types:
- Home page: Generates localized home URLs from
config.i18n.locales. - Static marketing pages: changelog, contact, pricing, features, etc., with inclusion controlled by
config.ui.*flags. - Legal pages: From
allLegalPagesin Content Collections. - Blog posts: Published posts under
content/posts, requiringconfig.ui.blog.enabled. - Docs pages: All docs under
content/docs, requiringconfig.ui.docs.enabled.
// src/app/sitemap.ts structure overview
export default async function sitemap(): Promise<MetadataRoute.Sitemap> {
const baseUrl = getBaseUrl();
const locales = config.i18n.enabled
? Object.keys(config.i18n.locales)
: [config.i18n.defaultLocale];
return [
// Home page
...locales.map((locale) => ({ url: new URL(`/${getSiteMapLocale(locale)}`, baseUrl).href, ... })),
// Static marketing pages (filtered by config)
// Legal pages
// Blog
// Docs
];
}Include Custom Routes in Sitemap
Routes registered in config.ui.headerConfig.customRoutes with enabled: true and external: false are automatically added to the static sitemap list.
robots.txt
The default configuration allows all crawlers to access the whole site:
// src/app/robots.ts
export default function robots(): MetadataRoute.Robots {
return {
rules: {
userAgent: "*",
allow: "/",
},
};
}To block specific paths, add disallow rules, for example:
rules: {
userAgent: "*",
allow: "/",
disallow: ["/api/", "/app/settings/"],
},metadata
Pages output SEO tags via Next.js generateMetadata:
- Root layout (
src/app/layout.tsx):metadataBase,manifest, defaultopenGraph, etc. - Landing pages (
src/app/(landing-page)/[locale]/layout.tsx): locale-specifictitle,description,keywords - Blog/docs/legal pages:
generateMetadatain eachpage.tsx, generated dynamically from content
i18n and Metadata
Use getTranslations from next-intl to get SEO copy for the current locale and ensure metadata is correct across multilingual pages.
Pre-Launch SEO Checklist
Ensure NEXT_PUBLIC_SITE_URL or an equivalent environment variable points to your production domain so sitemap and OG links are correct.
Visit https://your-domain/sitemap.xml and https://your-domain/robots.txt to verify the output.
Submit your sitemap in Google Search Console.
Use browser developer tools or an Open Graph debugger to check share previews.
Related Docs
- Internationalization — Multilingual routing and locale configuration
- Site Analytics — Google Analytics and Baidu Tongji integration