{"id":15551316,"url":"https://github.com/kuflash/react-router-sitemap","last_synced_at":"2025-04-12T16:37:29.154Z","repository":{"id":8792309,"uuid":"59777979","full_name":"kuflash/react-router-sitemap","owner":"kuflash","description":"Generate sitemap.xml by React Router configuration","archived":false,"fork":false,"pushed_at":"2022-04-18T05:44:29.000Z","size":178,"stargazers_count":252,"open_issues_count":39,"forks_count":60,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-03T17:11:14.952Z","etag":null,"topics":["react","react-router","sitemap"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kuflash.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-05-26T19:35:59.000Z","updated_at":"2025-02-24T15:51:31.000Z","dependencies_parsed_at":"2022-08-19T13:40:32.247Z","dependency_job_id":null,"html_url":"https://github.com/kuflash/react-router-sitemap","commit_stats":null,"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kuflash%2Freact-router-sitemap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kuflash%2Freact-router-sitemap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kuflash%2Freact-router-sitemap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kuflash%2Freact-router-sitemap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kuflash","download_url":"https://codeload.github.com/kuflash/react-router-sitemap/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248467458,"owners_count":21108648,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["react","react-router","sitemap"],"created_at":"2024-10-02T14:04:10.982Z","updated_at":"2025-04-12T16:37:29.131Z","avatar_url":"https://github.com/kuflash.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# React Router Sitemap\n\n[![Build Status](https://travis-ci.org/kuflash/react-router-sitemap.svg?branch=master)](https://travis-ci.org/kuflash/react-router-sitemap) [![npm version](https://badge.fury.io/js/react-router-sitemap.svg)](https://badge.fury.io/js/react-router-sitemap)\n\nModule for generating sitemaps using [React Router](https://www.npmjs.com/package/react-router) configuration. Also it can filter paths and replace params (like a `:paramName`) in dynamic paths.\n\n## Install\n\n`npm i --save react-router-sitemap`\n\n## Usage\n\nYou need to have a module with the router configuration. For example:\n\n`router.jsx`\n```js\nimport React from 'react';\nimport { Route } from 'react-router';\n\nexport default (\n\t\u003cRoute\u003e\n\t\t\u003cRoute path='/' /\u003e\n\t\t\u003cRoute path='/about' /\u003e\n\t\t\u003cRoute path='/projects' /\u003e\n\t\t\u003cRoute path='/contacts' /\u003e\n\t\t\u003cRoute path='/auth' /\u003e\n\t\u003c/Route\u003e\n);\n```\nIf you are using v4 `react-router`, your `router.jsx` might be:\n```js\nimport React from 'react';\nimport { Switch, Route } from 'react-router';\n\nexport default (\n\t// Switch is added in v4 react-router\n\t\u003cSwitch\u003e\n\t\t\u003cRoute path='/' /\u003e\n\t\t\u003cRoute path='/about' /\u003e\n\t\t\u003cRoute path='/projects' /\u003e\n\t\t\u003cRoute path='/contacts' /\u003e\n\t\t\u003cRoute path='/auth' /\u003e\n\t\t\u003cRoute /\u003e // No-match case\n\t\u003c/Switch\u003e\n);\n```\nAnd you need to create a script which will run from the command line or on the server.\n\n_Please note that in this case you need a module 'babel-register' to work with the ES2105 syntax and `.jsx` format._\n\n`sitemap-builder.js`\n\n```js\nrequire('babel-register');\n\nconst router = require('./router').default;\nconst Sitemap = require('../').default;\n\n(\n\tnew Sitemap(router)\n\t\t.build('http://my-site.ru')\n\t\t.save('./sitemap.xml')\n);\n```\n\nIt's a minimal example. After running the script, a `sitemap.xml` file will be created, which includes all paths, described in the configuration of `react-router`.\n\nA more detailed example can be found in the `example` directory. You can also explore the details of the [API](api.md).\n\n\n## [API](api.md)\nExplore the public API for using the module.\n\n## License\n\nReact Router Sitemap is freely distributable under the terms of the MIT license.\n\nMIT License\n\nCopyright (c) 2016 kuflash\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkuflash%2Freact-router-sitemap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkuflash%2Freact-router-sitemap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkuflash%2Freact-router-sitemap/lists"}