Socket
Socket
Sign inDemoInstall

react-static-plugin-sitemap

Package Overview
Dependencies
2
Maintainers
2
Versions
17
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    react-static-plugin-sitemap

A React-Static plugin for exporting sitemap information


Version published
Maintainers
2
Install size
294 kB
Created

Changelog

Source

7.3.0

New

  • Allow dots in routes. (#1365)
  • Add silent option (#1330)
  • Add clickable dev-server url (#1306)
  • Add unofficial plugin react-static-plugin-file-watch-reload to plugins list
  • Add configuring css loader from react-static-plugin-sass and react-static-plugin-less (#1348)
  • Change react-static-plugin-jss for react-jss v10+. (#1367)
  • Add inline script hashes to DocumentProps. These hashes can be used to construct a Content Security Policy in a meta tag without unsafe-inline scripts. (#1373)

Improved

  • Fix basePath edge case (#1344)
  • Fix typings withSiteData (#1319)
  • Fix "can not read property catch of undefined" (#1313)
  • Fix missing state.siteData in dev (#1148)
  • Fix empty or undefined error in sitemap plugin (#1233 and #1312)
  • Fix stderr pollution by progress module (#1356)
  • Fix package.json and README for react-static-plugin-stylus (#1244)
  • Fix Webpack stats output in environment that don't support color (#1370)

Readme

Source

react-static-plugin-sitemap

A React-Static plugin for exporting sitemap information.

Installation

In an existing react-static site run:

$ yarn add react-static-plugin-sitemap

Then add the plugin to your static.config.js:

export default {
  plugins: ['react-static-plugin-sitemap'],
}

Usage

  • A config.siteRoot is required for this plugin to work properly, since sitemap's are required to use full

  • Each route in your site will createt a <url> item in the sitemap

  • By default, the url's <loc> tag will be set to the prefixed path of each route.

  • All property/value pairs under a route's sitemap object will be used as xml tags for that route, eg.

    export default {
      siteRoot: 'https://hello.com'
    }
    const routes = [
      {
        path: '/blog/post/1',
        sitemap: {
          lastmod: '10/10/2010',
          priority: 0.5,
          'image:image': {
            'image:loc': `https://raw.githubusercontent.com/react-static/react-static/master/media/react-static-logo-2x.png`,
            'image:caption': 'React Static',
          },
        },
      },
    ]
    
    // Would result in the <url>:
    
    <url>
      <loc>https://hello.com/blog/post/1</loc>
      <lastmod>10/10/2010</lastmod>
      <priority>0.5</priority>
    </url>
    

With Options

export default {
  plugins: [
    [
      'react-static-plugin-sitemap',
      {
        getAttributes: route => ({
          customXmlAttribute: route.customProperty,
        }),

        // Given a route where route.customProperty === 40,
        // This would create a <customXmlAttribute></customXmlAttribute>
        // in that routes <url></url> tag
      },
    ],
  ],
}

FAQs

Last updated on 21 May 2020

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc