All Projects → TryGhost → Gatsby Plugin Advanced Sitemap

TryGhost / Gatsby Plugin Advanced Sitemap

Licence: mit
Advanced XML Sitemaps for Gatsby.js

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Gatsby Plugin Advanced Sitemap

Gatsby Theme Try Ghost
A Gatsby theme to build flaring fast blogs from headless Ghost CMS
Stars: ✭ 88 (-6.38%)
Mutual labels:  gatsby, static-site, gatsbyjs
Gatsby Docker
Develop & Build GatsbyJS static sites within Docker.
Stars: ✭ 184 (+95.74%)
Mutual labels:  gatsby, static-site, gatsbyjs
Gatsby Starter Try Ghost
Publish flaring fast blogs with Gatsby and Ghost
Stars: ✭ 137 (+45.74%)
Mutual labels:  gatsby, static-site, gatsbyjs
subtle-ui
A collection of clever yet understated user interactions found on the web
Stars: ✭ 39 (-58.51%)
Mutual labels:  gatsby, static-site, gatsbyjs
Gatsby Advanced Starter
A high performance skeleton starter for GatsbyJS that focuses on SEO/Social features/development environment.
Stars: ✭ 1,224 (+1202.13%)
Mutual labels:  gatsby, gatsbyjs, seo
Devblog
A lightweight, customizable personal blog template built with GatsbyJS and React
Stars: ✭ 312 (+231.91%)
Mutual labels:  gatsby, static-site, gatsbyjs
gatsby-attila-theme-ghost
A Gatsby theme plugin for creating blogs from headless Ghost CMS.
Stars: ✭ 16 (-82.98%)
Mutual labels:  gatsby, static-site, gatsbyjs
Gatsby Starter Gcn
A starter template to build amazing static websites with Gatsby, Contentful and Netlify
Stars: ✭ 488 (+419.15%)
Mutual labels:  gatsby, static-site, gatsbyjs
Gatsby Starter Ghost
A starter template to build lightning fast websites with Ghost & Gatsby
Stars: ✭ 752 (+700%)
Mutual labels:  gatsby, static-site, gatsbyjs
Ryosuke Gatsby Blog
Static PWA React-powered portfolio and blog built with GatsbyJS
Stars: ✭ 90 (-4.26%)
Mutual labels:  static-site, gatsbyjs
Gatsby Starter Spectral
Gatsby.js V2 starter template based on Spectral by HTML5 UP
Stars: ✭ 34 (-63.83%)
Mutual labels:  gatsby, gatsbyjs
Dantecalderon.dev
💻 ❤️ My personal website
Stars: ✭ 51 (-45.74%)
Mutual labels:  gatsby, gatsbyjs
Rw
Ryan Wiemer's Digital Portfolio
Stars: ✭ 87 (-7.45%)
Mutual labels:  gatsby, static-site
Gatsby Starter 2column Portfolio
A minimalistic portfolio with a 2 column layout made for GatsbyJS.
Stars: ✭ 33 (-64.89%)
Mutual labels:  gatsby, gatsbyjs
Jamtemplates.com
Curated collection of free Gatsby themes.
Stars: ✭ 47 (-50%)
Mutual labels:  gatsby, gatsbyjs
Gatsby Remark Embed Gist
Gatsby remark gists preprocessor
Stars: ✭ 30 (-68.09%)
Mutual labels:  gatsby, gatsbyjs
Elderjs
Elder.js is an opinionated static site generator and web framework for Svelte built with SEO in mind.
Stars: ✭ 1,102 (+1072.34%)
Mutual labels:  static-site, seo
Gatsby Material Ui Business Starter
Beautiful Gatsby Material UI Business Starter
Stars: ✭ 62 (-34.04%)
Mutual labels:  gatsby, gatsbyjs
Blog
My blog created with React, Gatsby & Markdown
Stars: ✭ 29 (-69.15%)
Mutual labels:  gatsby, gatsbyjs
Gatsby Starter Portfolio Cara
Playful and Colorful One-Page portfolio featuring Parallax effects and animations. Especially designers and/or photographers will love this theme! Built with MDX and Theme UI.
Stars: ✭ 1,101 (+1071.28%)
Mutual labels:  gatsby, gatsbyjs

gatsby-plugin-advanced-sitemap

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

 

example

NOTE: This plugin only generates output in production mode! To test, run: gatsby build && gatsby serve

 

Install

npm install --save gatsby-plugin-advanced-sitemap

How to Use

By default this plugin will generate a single sitemap of all pages on your site, without any configuration needed.

// gatsby-config.js

siteMetadata: {
    siteUrl: `https://www.example.com`,
},
plugins: [
    `gatsby-plugin-advanced-sitemap`
]

 

Options

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:

// gatsby-config.js

plugins: [
    {
        resolve: `gatsby-plugin-advanced-sitemap`,
        options: {
             // 1 query for each data type
            query: `
            {
                allGhostPost {
                    edges {
                        node {
                            id
                            slug
                            updated_at
                            feature_image
                        }
                    }
                }
                allGhostPage {
                    edges {
                        node {
                            id
                            slug
                            updated_at
                            feature_image
                        }
                    }
                }
                allGhostTag {
                    edges {
                        node {
                            id
                            slug
                            feature_image
                        }
                    }
                }
                allGhostAuthor {
                    edges {
                        node {
                            id
                            slug
                            profile_image
                        }
                    }
                }
            }`,
            // The filepath and name to Index Sitemap. Defaults to '/sitemap.xml'.
            output: "/custom-sitemap.xml",
            mapping: {
                // Each data type can be mapped to a predefined sitemap
                // Routes can be grouped in one of: posts, tags, authors, pages, or a custom name
                // The default sitemap - if none is passed - will be pages
                allGhostPost: {
                    sitemap: `posts`,
                    // Add a query level prefix to slugs, Don't get confused with global path prefix from Gatsby
                    // This will add a prefix to this perticular sitemap only
                    prefix: 'your-prefix/',
                    // Custom Serializer 
                    serializer: (edges) => {
                        return edges.map(({ node }) => {
                            (...) // Custom logic to change final sitemap.
                        })
                    }
                },
                allGhostTag: {
                    sitemap: `tags`,
                },
                allGhostAuthor: {
                    sitemap: `authors`,
                },
                allGhostPage: {
                    sitemap: `pages`,
                },
            },
            exclude: [
                `/dev-404-page`,
                `/404`,
                `/404.html`,
                `/offline-plugin-app-shell-fallback`,
                `/my-excluded-page`,
                /(\/)?hash-\S*/, // you can also pass valid RegExp to exclude internal tags for example
            ],
            createLinkInHead: true, // optional: create a link in the `<head>` of your site
            addUncaughtPages: true, // optional: will fill up pages that are not caught by queries and mapping and list them under `sitemap-pages.xml`
            additionalSitemaps: [ // optional: add additional sitemaps, which are e. g. generated somewhere else, but need to be indexed for this domain
                {
                    name: `my-other-posts`,
                    url: `/blog/sitemap-posts.xml`,
                },
                {
                    url: `https://example.com/sitemap.xml`,
                },
            ],
        }
    }
]

Example output of ☝️ this exact config 👉 https://gatsby.ghost.org/sitemap.xml

Develop Plugin

  • Pull the repo
  1. Install dependencies
yarn install

Build Plugin

yarn build

Run Tests

yarn test

 

Copyright & License

Copyright (c) 2013-2021 Ghost Foundation - Released under the MIT license.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].