Gathering detailed insights and metrics for gatsby-plugin-advanced-sitemap
Gathering detailed insights and metrics for gatsby-plugin-advanced-sitemap
Gathering detailed insights and metrics for gatsby-plugin-advanced-sitemap
Gathering detailed insights and metrics for gatsby-plugin-advanced-sitemap
npm install gatsby-plugin-advanced-sitemap
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
150 Stars
313 Commits
11 Watching
2 Branches
47 Contributors
Updated on 25 Jul 2024
JavaScript (84.39%)
XSLT (15.61%)
Cumulative downloads
Total Downloads
Last day
5.1%
1,968
Compared to previous day
Last week
3.2%
10,799
Compared to previous week
Last month
2.2%
44,175
Compared to previous month
Last year
-30.7%
848,238
Compared to previous year
The default Gatsby sitemap plugin generates a simple blob of raw XML for all your pages. This advanced sitemap plugin adds more power and configuration, generating a single or multiple sitemaps with full XSL templates to make them neatly organised and human + machine readable, as well linking image resources to encourage media indexing.
Demo: https://gatsby.ghost.org/sitemap.xml
NOTE: This plugin only generates output in production
mode! To test, run: gatsby build && gatsby serve
npm install --save gatsby-plugin-advanced-sitemap
By default this plugin will generate a single sitemap of all pages on your site, without any configuration needed.
1// gatsby-config.js 2 3siteMetadata: { 4 siteUrl: `https://www.example.com`, 5}, 6plugins: [ 7 `gatsby-plugin-advanced-sitemap` 8]
If you want to generate advanced, individually organised sitemaps based on your data, you can do so by passing in a query and config. The example below uses Ghost, but this should work with any data source - including Pages, Markdown, Contentful, etc.
Example:
1// gatsby-config.js 2 3plugins: [ 4 { 5 resolve: `gatsby-plugin-advanced-sitemap`, 6 options: { 7 // 1 query for each data type 8 query: ` 9 { 10 allGhostPost { 11 edges { 12 node { 13 id 14 slug 15 updated_at 16 feature_image 17 } 18 } 19 } 20 allGhostPage { 21 edges { 22 node { 23 id 24 slug 25 updated_at 26 feature_image 27 } 28 } 29 } 30 allGhostTag { 31 edges { 32 node { 33 id 34 slug 35 feature_image 36 } 37 } 38 } 39 allGhostAuthor { 40 edges { 41 node { 42 id 43 slug 44 profile_image 45 } 46 } 47 } 48 }`, 49 // The filepath and name to Index Sitemap. Defaults to '/sitemap.xml'. 50 output: "/custom-sitemap.xml", 51 mapping: { 52 // Each data type can be mapped to a predefined sitemap 53 // Routes can be grouped in one of: posts, tags, authors, pages, or a custom name 54 // The default sitemap - if none is passed - will be pages 55 allGhostPost: { 56 sitemap: `posts`, 57 // Add a query level prefix to slugs, Don't get confused with global path prefix from Gatsby 58 // This will add a prefix to this particular sitemap only 59 prefix: 'your-prefix/', 60 // Custom Serializer 61 serializer: (edges) => { 62 return edges.map(({ node }) => { 63 (...) // Custom logic to change final sitemap. 64 }) 65 } 66 }, 67 allGhostTag: { 68 sitemap: `tags`, 69 }, 70 allGhostAuthor: { 71 sitemap: `authors`, 72 }, 73 allGhostPage: { 74 sitemap: `pages`, 75 }, 76 }, 77 exclude: [ 78 `/dev-404-page`, 79 `/404`, 80 `/404.html`, 81 `/offline-plugin-app-shell-fallback`, 82 `/my-excluded-page`, 83 /(\/)?hash-\S*/, // you can also pass valid RegExp to exclude internal tags for example 84 ], 85 createLinkInHead: true, // optional: create a link in the `<head>` of your site 86 addUncaughtPages: true, // optional: will fill up pages that are not caught by queries and mapping and list them under `sitemap-pages.xml` 87 additionalSitemaps: [ // optional: add additional sitemaps, which are e. g. generated somewhere else, but need to be indexed for this domain 88 { 89 name: `my-other-posts`, 90 url: `/blog/sitemap-posts.xml`, 91 }, 92 { 93 url: `https://example.com/sitemap.xml`, 94 }, 95 ], 96 } 97 } 98]
Example output of ☝️ this exact config 👉 https://gatsby.ghost.org/sitemap.xml
1yarn install
Build Plugin
1yarn build
Run Tests
1yarn test
Copyright (c) 2013-2023 Ghost Foundation - Released under the MIT license.
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
security policy file detected
Details
Reason
Found 0/30 approved changesets -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
54 existing vulnerabilities detected
Details
Score
Last Scanned on 2024-11-18
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More