Socket
Socket
Sign inDemoInstall

gatsby-plugin-sitemap

Package Overview
Dependencies
Maintainers
6
Versions
524
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gatsby-plugin-sitemap

Gatsby plugin that automatically creates a sitemap for your site


Version published
Weekly downloads
110K
increased by1.52%
Maintainers
6
Weekly downloads
 
Created

What is gatsby-plugin-sitemap?

The gatsby-plugin-sitemap package is a Gatsby plugin that generates a sitemap for your Gatsby site. This helps search engines to better crawl your site and understand its structure.

What are gatsby-plugin-sitemap's main functionalities?

Basic Sitemap Generation

This feature allows you to generate a basic sitemap for your Gatsby site. The sitemap will be output to the specified path, in this case, '/sitemap.xml'.

{
  "resolve": "gatsby-plugin-sitemap",
  "options": {
    "output": "/sitemap.xml"
  }
}

Custom Query for Sitemap

This feature allows you to customize the query used to generate the sitemap. You can specify which pages to include in the sitemap by modifying the GraphQL query.

{
  "resolve": "gatsby-plugin-sitemap",
  "options": {
    "query": `{
      site {
        siteMetadata {
          siteUrl
        }
      }
      allSitePage {
        nodes {
          path
        }
      }
    }`,
    "output": "/sitemap.xml"
  }
}

Excluding Specific Pages

This feature allows you to exclude specific pages from the sitemap. You can provide an array of paths that should not be included in the generated sitemap.

{
  "resolve": "gatsby-plugin-sitemap",
  "options": {
    "exclude": [
      "/path/to/page",
      "/another/path/to/page"
    ],
    "output": "/sitemap.xml"
  }
}

Customizing Sitemap Entries

This feature allows you to customize the entries in the sitemap. You can specify additional properties like 'changefreq' and 'priority' for each URL.

{
  "resolve": "gatsby-plugin-sitemap",
  "options": {
    "serialize": ({ site, allSitePage }) =>
      allSitePage.nodes.map(node => {
        return {
          url: `${site.siteMetadata.siteUrl}${node.path}`,
          changefreq: `daily`,
          priority: 0.7,
        }
      }),
    "output": "/sitemap.xml"
  }
}

Other packages similar to gatsby-plugin-sitemap

Keywords

FAQs

Package last updated on 23 Jan 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc