Search Engine Optimization
Learn how to optimize your Dirstarter website for search engines and social media sharing.
Dirstarter comes with built-in SEO features to help your directory website rank better in search engines and look great when shared on social media.
Metadata Configuration
The metadata configuration in Dirstarter is centralized and type-safe using Next.js's Metadata API. The base configuration is located in config/metadata.ts
:
Static Pages
For static pages, you can define metadata directly in the page component:
Dynamic Pages
For dynamic pages (like tool pages, blog posts), use the generateMetadata
function:
OpenGraph Images
Dirstarter automatically generates OpenGraph images for tools using Next.js's Image Response API. The images are generated on-demand and optimized for social media sharing.
Base Template
The base OpenGraph image template is defined in components/web/og/og-base.tsx
:
Dynamic Generation
OpenGraph images are generated dynamically for each tool using the opengraph-image.tsx
route:
Sitemap Generation
Dirstarter automatically generates a sitemap for all your pages using Next.js's built-in sitemap generation. The sitemap is configured in app/sitemap.ts
:
Robots.txt
The robots.txt file is also automatically generated and configured to allow search engines to crawl your site while protecting sensitive routes:
Additional SEO Features
- Canonical URLs: Every page has a canonical URL to prevent duplicate content issues.
- RSS Feed: Built-in RSS feed support for blog posts and content updates.
- Structured Data: Automatically generated JSON-LD for tools and blog posts.
- Mobile Optimization: All pages are responsive and mobile-friendly by default.
- Performance: Built-in image optimization and lazy loading for better Core Web Vitals.
Last updated on