A modern news portal built with Next.js, Firebase, and Tailwind CSS.
This project uses Next.js App Router's built-in metadata API for server-side SEO optimization.
-
Server-side metadata generation:
- Each news article page (
app/news/[id]/page.tsx) uses thegenerateMetadatafunction to create dynamic meta tags. - This ensures search engines receive proper metadata for indexing.
- Each news article page (
-
Client-side SEO component:
- A
SEO.jscomponent is available for any additional client-side meta tags if needed. - The primary SEO is handled server-side for better performance and indexing.
- A
-
Metadata includes:
- Title:
${news.title} - News Dikhao - Description: Uses excerpt or first 150 characters of content
- Keywords: Generated from tags, category, and default keywords
- Open Graph tags: For social media sharing
- Twitter Card tags: For Twitter sharing
- Canonical URL: To prevent duplicate content issues
- Title:
The SEO implementation is automatic for news articles. When a news item is added to Firebase with proper fields (title, content, excerpt, featuredImage, etc.), the metadata will be generated automatically.
app/news/[id]/page.tsx- Server-side metadata generationcomponents/SEO.js- Client-side SEO component (if needed)lib/types.ts- Type definitions including NewsItem interface
The project includes proper Content-Type headers for:
/sitemap.xml:application/xml/robots.txt:text/plain
These headers are defined in public/_headers for Vercel deployment.