SEO is crucial for enhancing your platform’s visibility on search engines like Google. This document outlines the key Search Engine Optimization (SEO) strategies implemented to boost your site's ranking and drive more organic traffic.
Features
🏷️ Meta Tags: Essential meta tags for better search engine visibility and social media sharing.
🛠️ JSON-LD Schema: Structured data to help search engines understand your content.
🌐 Sitemap: A dynamically generated sitemap for efficient web crawling.
🤖 robots.txt: A file to guide search engines on what to crawl and what to ignore.
🔗 Link Tags: Canonical URLs, icons, and other link-related optimizations.
⚡ Script Optimization: Optimizing scripts for performance and SEO-friendly integration.
🖼️ Image Optimization: Utilizing Next.js next/image to serve optimized images for faster loading times.
What's Included
Meta Tags
Meta tags provide key information to search engines and social media platforms. They include tags like title, description, keywords, and Open Graph tags for platforms like Facebook, and Twitter tags for Twitter sharing. You can define static metadata by adding the export const metadata argument inside page.tsx or layout.tsx:
For dynamic metadata you can use generateMetedata, generateMetadata should return a Metadata object containing one or more metadata fields. You can put this function into [slug]/page.tsx:
JSON-LD Schema
JSON-LD is a lightweight data format that helps search engines understand the content on your website. You can put it inside the head tag or the body tag:
Sitemap
A sitemap helps search engines to efficiently crawl your website and index your URLs. In the App Router, a dynamic sitemap is generated via sitemap.ts, then you can check it at: starbase.dev/sitemap.xml`:
robots.txt
This file controls which pages search engines should and shouldn’t crawl.
A dynamic robots.ts file can be created to manage this:
Link Tags
Important link tags such as canonical, icon, and apple-touch-icon should be included. For Next.js App Router, the link tags can be defined using the export const metadata or generateMetadata.
Script Optimization
Use Next.js <Script> for managing external scripts and optimizing their loading.
If you are using one of these: Google Tag Manager, Google Analytics, Google Maps Embed, YouTube Embed, you can add them via @next/third-parties. First you need to install it:
Then you can import what you need from the library like this:
Image Optimization
Better loading times means better SEO. It can contribute your Google PageSpeed score. For image optimization, Next.js provides the next/image component for automatically optimizing and serving images.