SEO TO‐DOs for new Docusaurus Site - spmsolutions/seo GitHub Wiki

After deploying your Docusaurus site, you can take several steps to optimize it for search engine optimization (SEO). Here’s a checklist:

1. Optimize Meta Tags

  • Title Tags: Ensure that each page has a unique and descriptive title. You can set default meta tags in docusaurus.config.js:

    module.exports = {
      title: 'Your Site Title',
      tagline: 'Your Site Tagline',
      // Other configurations...
    };
    
  • Meta Descriptions: Add a meta description to provide a summary of each page’s content. This can be done in the docusaurus.config.js file under the themeConfig:

    module.exports = {
      themeConfig: {
        metadata: [
          { name: 'description', content: 'A brief description of your site' },
          { name: 'keywords', content: 'keyword1, keyword2, keyword3' },
        ],
      },
      // Other configurations...
    };
    
  • Open Graph and Twitter Cards: Add Open Graph and Twitter card tags to improve how your site is displayed on social media:

    module.exports = {
      themeConfig: {
        metadata: [
          { name: 'og:title', content: 'Your Site Title' },
          { name: 'og:description', content: 'A brief description of your site' },
          { name: 'og:image', content: 'https://your-site-url.com/img/logo.png' },
          { name: 'twitter:card', content: 'summary_large_image' },
          { name: 'twitter:title', content: 'Your Site Title' },
          { name: 'twitter:description', content: 'A brief description of your site' },
          { name: 'twitter:image', content: 'https://your-site-url.com/img/logo.png' },
        ],
      },
      // Other configurations...
    };
    

2. Create a Sitemap

  • Enable Sitemap (XML index) Generation: Docusaurus can automatically generate a sitemap for your site. In your docusaurus.config.js, make sure the sitemap plugin is enabled:

    module.exports = {
      plugins: [
        [
          '@docusaurus/plugin-sitemap',
          {
            id: 'default',
            changefreq: 'weekly',
            priority: 0.5,
          },
        ],
      ],
    };
    
  • Submit the Sitemap: After generating the sitemap, submit it to Google Search Console and other search engines to help them index your site more effectively.

3. Improve Page Load Speed

  • Optimize Images: Ensure all images are optimized for web (compressed and properly sized). Use formats like WebP for better performance.
  • Minify CSS and JS: Docusaurus typically handles this during the build process, but ensure that all CSS and JS files are minified.
  • Use a CDN: If possible, serve your static assets (CSS, JS, images) from a Content Delivery Network (CDN) for faster load times globally.

4. Mobile Optimization

  • Responsive Design: Docusaurus sites are generally responsive, but ensure that all custom components are also mobile-friendly.
  • Mobile Usability: Use Google’s Mobile-Friendly Test tool to check how your site performs on mobile devices.

5. Add Structured Data

  • Schema Markup: Implement structured data (schema.org) to help search engines understand your content better. You can add JSON-LD structured data within your site’s head tag:

    module.exports = {
      themeConfig: {
        metadata: [
          {
            type: 'application/ld+json',
            content: `{
              "@context": "https://schema.org",
              "@type": "Organization",
              "url": "https://your-site-url.com",
              "logo": "https://your-site-url.com/img/logo.png"
            }`,
          },
        ],
      },
    };
    

6. Enable HTTPS

  • Ensure Your Site is Served Over HTTPS: HTTPS is a ranking factor for Google. GitHub Pages automatically provides HTTPS for custom domains, so make sure your site is accessible via https://.

7. Configure Robots.txt

  • Control Crawling: Add a robots.txt file to your site to control how search engines crawl your site. Docusaurus can generate a robots.txt file via a plugin:

    module.exports = {
      plugins: [
        '@docusaurus/plugin-robots-txt',
      ],
    };
    

8. Monitor SEO Performance

  • Google Search Console: Add your site to Google Search Console to monitor how Google indexes your site and to identify any SEO issues.
  • Analytics: Use Google Analytics or other tools to track visitor behavior and site performance.

9. Optimize Content for Keywords

  • Keyword Research: Identify relevant keywords for your content and use them naturally in your titles, headings, and body text.
  • Content Hierarchy: Use appropriate heading tags (H1, H2, H3, etc.) to structure your content logically.

10. Internal Linking

  • Link Between Pages: Use internal links to connect related content, helping users and search engines navigate your site more effectively.

By following these steps, you can significantly improve your Docusaurus site’s SEO, leading to better visibility and performance in search engine results.