Nimble Polyglot Microcosm

    react-router-sitemap-generator

    0.0.8 • Public • Published

    react-router-sitemap-generator

    Master npm package npm

    Generate sitemap.xml from react-router.

    Get started

    Install react-router-sitemap-generator

    yarn add --dev react-router-sitemap-generator

    Add babel

    yarn add --dev @babel/node @babel/preset-env @babel/preset-react

    Add preset to your babel config file .babelrc

    {
      "presets": ["@babel/preset-env", "@babel/preset-react"]
    }

    Add a sitemap generator file

    // sitemap.js
    
    import Generator from 'react-router-sitemap-generator';
    import Router from './component/Router'; //import your react router component
    
    const generator = new Generator(
      'https://react-router-sitemap-generator.com',
      Router(),
      {
        lastmod: new Date().toISOString().slice(0, 10),
        changefreq: 'monthly',
        priority: 0.8,
      }
    );
    generator.save('public/sitemap.xml');

    Run generator file

    yarb run babel-node sitemap.js

    Roadmap

    • Support nested routes

    Keywords

    none

    Install

    npm i react-router-sitemap-generator

    DownloadsWeekly Downloads

    240

    Version

    0.0.8

    License

    MIT

    Unpacked Size

    9.21 kB

    Total Files

    4

    Last publish

    Collaborators

    • clh161