SEO
LaunchFast provides built-in SEO support through per-route meta exports, automatic /robots.txt and /sitemap.xml generation, and redirect rules for canonical URLs.
Per-route meta tags
Remix supports a meta export on each route that sets <meta> tags for that page. Use this for titles, descriptions, and Open Graph tags:
import { type MetaFunction } from '@remix-run/node'
export const meta: MetaFunction = () => [
{ title: 'My Page' },
{ name: 'description', content: 'Page description' },
]Robots and sitemap
LaunchFast generates /robots.txt and /sitemap.xml via resource routes using @nasa-gcn/remix-seo. These routes live in the _seo+/ folder. All routes are included in the sitemap by default.
Excluding routes from the sitemap
To exclude a route from the sitemap, add a handle export that returns null for sitemap entries:
import { type SEOHandle } from '@nasa-gcn/remix-seo'
export const handle: SEOHandle = {
getSitemapEntries: () => null,
}Dynamic sitemap entries
For routes with dynamic segments (like blog posts), return entries from a database query:
export const handle: SEOHandle = {
getSitemapEntries: async () => {
const posts = await db.post.findMany()
return posts.map(post => ({
route: `/blog/${post.slug}`,
priority: 0.7,
}))
},
}Controlling indexing
The ALLOW_INDEXING environment variable controls whether search engines are allowed to index your site. Set it to true for production and false for staging environments to prevent duplicate content issues.
Related
- Redirects — canonical URL enforcement and trailing slash removal
- Environment variables — configuring
ALLOW_INDEXING