[
  {
    "path": ".all-contributorsrc",
    "content": "{\n  \"files\": [\n    \"README.md\"\n  ],\n  \"imageSize\": 100,\n  \"commit\": false,\n  \"contributors\": [\n    {\n      \"login\": \"getriot\",\n      \"name\": \"Daniele Simeone\",\n      \"avatar_url\": \"https://avatars3.githubusercontent.com/u/2164596?v=4\",\n      \"profile\": \"https://github.com/getriot\",\n      \"contributions\": [\n        \"code\"\n      ]\n    },\n    {\n      \"login\": \"illiteratewriter\",\n      \"name\": \"illiteratewriter\",\n      \"avatar_url\": \"https://avatars1.githubusercontent.com/u/5787110?v=4\",\n      \"profile\": \"https://github.com/illiteratewriter\",\n      \"contributions\": [\n        \"doc\"\n      ]\n    },\n    {\n      \"login\": \"goran-zdjelar\",\n      \"name\": \"Goran Zdjelar\",\n      \"avatar_url\": \"https://avatars2.githubusercontent.com/u/45183713?v=4\",\n      \"profile\": \"https://github.com/goran-zdjelar\",\n      \"contributions\": [\n        \"code\"\n      ]\n    },\n    {\n      \"login\": \"jlaramie\",\n      \"name\": \"jlaramie\",\n      \"avatar_url\": \"https://avatars0.githubusercontent.com/u/755748?v=4\",\n      \"profile\": \"https://github.com/jlaramie\",\n      \"contributions\": [\n        \"code\"\n      ]\n    },\n    {\n      \"login\": \"stewartmcgown\",\n      \"name\": \"Stewart McGown\",\n      \"avatar_url\": \"https://avatars2.githubusercontent.com/u/1136276?v=4\",\n      \"profile\": \"https://ecoeats.uk\",\n      \"contributions\": [\n        \"doc\"\n      ]\n    },\n    {\n      \"login\": \"jordanandree\",\n      \"name\": \"Jordan Andree\",\n      \"avatar_url\": \"https://avatars0.githubusercontent.com/u/235503?v=4\",\n      \"profile\": \"https://jordanandree.com\",\n      \"contributions\": [\n        \"code\"\n      ]\n    },\n    {\n      \"login\": \"sakamossan\",\n      \"name\": \"sakamossan\",\n      \"avatar_url\": \"https://avatars3.githubusercontent.com/u/5309672?v=4\",\n      \"profile\": \"https://github.com/sakamossan\",\n      \"contributions\": [\n        \"code\"\n      ]\n    }\n  ],\n  \"contributorsPerLine\": 7,\n  \"projectName\": \"nextjs-sitemap-generator\",\n  \"projectOwner\": \"IlusionDev\",\n  \"repoType\": \"github\",\n  \"repoHost\": \"https://github.com\",\n  \"skipCi\": true\n}\n"
  },
  {
    "path": ".babelrc",
    "content": "{\n  \"presets\": [\"@babel/preset-env\"]\n}\n"
  },
  {
    "path": ".eslintrc.json",
    "content": "{\n  \"env\": {\n    \"es6\": true,\n    \"node\": true\n  },\n  \"extends\": [\n    \"standard\",\n    \"plugin:import/typescript\",\n    \"plugin:import/warnings\",\n    \"plugin:import/errors\"\n  ],\n  \"globals\": {\n    \"Atomics\": \"readonly\",\n    \"SharedArrayBuffer\": \"readonly\"\n  },\n  \"parser\": \"@typescript-eslint/parser\",\n  \"parserOptions\": {\n    \"ecmaVersion\": 2018,\n    \"sourceType\": \"module\"\n  },\n  \"settings\": {\n    \"import/resolver\": {\n      \"node\": {\n        \"paths\": [\n          \"src\"\n        ]\n      }\n    }\n  },\n  \"plugins\": [\n    \"@typescript-eslint\"\n  ],\n  \"rules\": {}\n}"
  },
  {
    "path": ".gitignore",
    "content": ".idea/\n/node_modules\npackage-lock.json\nexample/static/main.xml\n/lib\nsrc\t\nexample\t\ntsconfig.json"
  },
  {
    "path": "LICENSE",
    "content": "MIT License\n\nCopyright (c) 2019 Adrián Alonso Vergara\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"
  },
  {
    "path": "README.md",
    "content": "\n![npmv1](https://img.shields.io/npm/v/nextjs-sitemap-generator.svg)\n\n[![All Contributors](https://img.shields.io/badge/all_contributors-4-orange.svg?style=flat-square)](#contributors)\n\n  ## DEPRECATION\n**Due to new emerging libraries doing the same functionability this library is marked as deprecated and consider using [Next-Sitemap](https://github.com/iamvishnusankar/next-sitemap) library.**\n\nWe are looking for maintainers because I don't have enough time to maintain the package.\n\nPlease consider to make a donation for the maintenance of the project.\n\n[Donate](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YFXG8SLXPEVXN&source=url)\n\n  \n\nSimple `sitemap.xml` mapper for Next.js projects.\n\n## Installation\n\nTo install the package execute this in your terminal if you are using yarn:\n\n```\n\nyarn add nextjs-sitemap-generator\n\n```\n\nAnd this if you are using npm:\n\n```\n\nnpm i --save-dev nextjs-sitemap-generator\n\n```\n\nNextJs starts it's own server to serve all created files. But there are another option called [Custom server](https://nextjs.org/docs/advanced-features/custom-server) that uses a file to start a next server.\n\nIf you want use this package you must create the sever file. You can find how to do it here [NextJs custom server](https://nextjs.org/docs/advanced-features/custom-server)\n\n  \n  \n  \n\nThis module have been created to be used at node [custom server](https://nextjs.org/docs/advanced-features/custom-server) side of NextJs.\n\nIt is meant to be used in index.js/server.js so that when the server is initialized it will only run once.\n\nIf you place it in any of the request handler of the node server performance may be affected.\n\n  \n\nFor those people who deploy in Vercel:\n\n> A custom server can not be deployed on Vercel, the platform Next.js was made for.\n\n  \n\nFor example:\n\nIf you have this example server file\n\n```js\n\n// server.js\n\nconst sitemap =  require('nextjs-sitemap-generator');  // Import the package\n\nconst  { createServer }  =  require('http')\n\nconst  { parse }  =  require('url')\n\nconst next =  require('next')\n\n  \n\nconst dev = process.env.NODE_ENV !==  'production'\n\nconst app =  next({ dev })\n\nconst handle = app.getRequestHandler()\n\n  \n\n/*\n\nHere you is you have to use the sitemap function.\n\nUsing it here you are allowing to generate the sitemap file\n\nonly once, just when the server starts.\n\n*/\n\nsitemap({\n  alternateUrls: {\n    en: 'https://example.en',\n    es: 'https://example.es',\n    ja: 'https://example.jp',\n    fr: 'https://example.fr',\n  },\n  baseUrl: 'https://example.com',\n  ignoredPaths: ['admin'],\n  extraPaths: ['/extraPath'],\n  pagesDirectory: __dirname + \"\\\\pages\",\n  targetDirectory : 'static/',\n  sitemapFilename: 'sitemap.xml',\n  nextConfigPath: __dirname + \"\\\\next.config.js\"\n});\n\n  \n\napp.prepare().then(()  =>  {\n  createServer((req,  res)  =>  {\n    const  parsedUrl  =  parse(req.url,  true)\n    const  {  pathname,  query  }  =  parsedUrl\n    if (pathname  ===  '/a') {\n      app.render(req,  res,  '/a',  query)\n    }  \n    else  if (pathname  ===  '/b') {\n      app.render(req,  res,  '/b',  query)\n    }  else  {\n      handle(req,  res,  parsedUrl)\n  }}).listen(3000,  (err)  =>  {\n    if (err) throw  err\n    console.log('> Ready on http://localhost:3000')\n })\n})\n\n```\n\n  \n\n#### Usage for static HTML apps\n\n\nIf you are exporting the next project as a static HTML app, create a next-sitemap-generator script file in the base directory.\n\nThe option `pagesDirectory` should point to the static files output folder.\n\nAfter generating the output files, run `node your_nextjs_sitemap_generator.js` to generate the sitemap.\n\n  \n\nIf your pages are statically served then you will need to set the `allowFileExtensions` option as `true` so that the pages contain the extension, most cases being `.html`.\n\n#### Usage with `getStaticPaths`\n\nIf you are using `next@^9.4.0`, you may have your site configured with getStaticPaths to pregenerate pages on dynamic routes. To add those to your sitemap, you need to load the BUILD_ID file into your config to reach the generated build directory with statics pages inside, whilst excluding everything that isn't static pages:\n\n  \n\n```js\n\nconst sitemap =  require(\"nextjs-sitemap-generator\");\n\nconst fs =  require(\"fs\");\n\n  \n\nconst BUILD_ID = fs.readFileSync(\".next/BUILD_ID\").toString();\n\n  \n\nsitemap({\n  baseUrl: \"https://example.com\",\n  // If you are using Vercel platform to deploy change the route to /.next/serverless/pages \n  pagesDirectory: __dirname + \"/.next/server/static/\" + BUILD_ID + \"/pages\",\n  targetDirectory: \"public/\",\n  ignoredExtensions: [\"js\", \"map\"],\n  ignoredPaths: [\"assets\"], // Exclude everything that isn't static page\n});\n\n```\n\n  \n\n## OPTIONS\n\n  \n\n```javascript\n// your_nextjs_sitemap_generator.js\n\nconst sitemap = require(\"nextjs-sitemap-generator\");\n\nsitemap({\n  alternateUrls: {\n    en: \"https://example.en\",\n    es: \"https://example.es\",\n    ja: \"https://example.jp\",\n    fr: \"https://example.fr\",\n  },\n  baseUrl: \"https://example.com\",\n  ignoredPaths: [\"admin\"],\n  extraPaths: [\"/extraPath\"],\n  pagesDirectory: __dirname + \"\\\\pages\",\n  targetDirectory: \"static/\",\n  sitemapFilename: \"sitemap.xml\",\n  nextConfigPath: __dirname + \"\\\\next.config.js\",\n  ignoredExtensions: [\"png\", \"jpg\"],\n  pagesConfig: {\n    \"/login\": {\n      priority: \"0.5\",\n      changefreq: \"daily\",\n    },\n  },\n  sitemapStylesheet: [\n    {\n      type: \"text/css\",\n      styleFile: \"/test/styles.css\",\n    },\n    {\n      type: \"text/xsl\",\n      styleFile: \"test/test/styles.xls\",\n    },\n  ],\n});\n\nconsole.log(`✅ sitemap.xml generated!`);\n\n\n```\n## OPTIONS description\n-  **alternateUrls**: You can add the alternate domains corresponding to the available language. (OPTIONAL)\n\n-  **baseUrl**: The url that it's going to be used at the beginning of each page.\n\n-  **ignoreIndexFiles**: Whether index file should be in URL or just directory ending with the slash (OPTIONAL)\n\n-  **ignoredPaths**: File or directory to not map (like admin routes).(OPTIONAL)\n\n-  **extraPaths**: Array of extra paths to include in the sitemap (even if not present in pagesDirectory) (OPTIONAL)\n\n-  **ignoredExtensions**: Ignore files by extension.(OPTIONAL)\n\n-  **pagesDirectory**: The directory where Nextjs pages live. You can use another directory while they are nextjs pages. **It must to be an absolute path**.\n\n-  **targetDirectory**: The directory where sitemap.xml going to be written.\n\n-  **sitemapFilename**: The filename for the sitemap. Defaults to `sitemap.xml`. (OPTIONAL)\n\n-  **pagesConfig**: Object configuration of priority and changefreq per route. Accepts regex patterns(OPTIONAL) **Path keys must be lowercase**\n\n-  **sitemapStylesheet**: Array of style objects that will be applied to sitemap.(OPTIONAL)\n\n-  **nextConfigPath**(Used for dynamic routes): Calls `exportPathMap` if exported from `nextConfigPath` js file.\n\n    See this to understand how to do it (https://nextjs.org/docs/api-reference/next.config.js/exportPathMap) (OPTIONAL)\n\n-  **allowFileExtensions**(Used for static applications): Ensures the file extension is displayed with the path in the sitemap. If you are using nextConfigPath with exportTrailingSlash in next config, allowFileExtensions will be ignored.  (OPTIONAL)\n  \n\n## Considerations\nFor now the **ignoredPaths** matches whatever cointaning the thing you put, ignoring if there are files or directories.\nIn the next versions this going to be fixed.\n"
  },
  {
    "path": "jest.config.js",
    "content": "module.exports = {\n  preset: 'ts-jest',\n  testEnvironment: 'node'\n}\n"
  },
  {
    "path": "package.json",
    "content": "{\n  \"name\": \"nextjs-sitemap-generator\",\n  \"version\": \"1.3.0\",\n  \"description\": \"Generate sitemap.xml from nextjs pages\",\n  \"main\": \"lib/index.js\",\n  \"types\": \"lib/index.d.ts\",\n  \"scripts\": {\n    \"test\": \"yarn jest && tsc\",\n    \"tsc\": \"tsc\"\n  },\n  \"keywords\": [\n    \"nextjs\",\n    \"sitemap.xml\",\n    \"pages\",\n    \"node\",\n    \"sitemap\"\n  ],\n  \"author\": \"Adrián Alonso Vergara\",\n  \"license\": \"MIT\",\n  \"dependencies\": {\n    \"date-fns\": \"^2.9.0\"\n  },\n  \"husky\": {\n    \"hooks\": {\n      \"pre-push\": \"yarn jest\"\n    }\n  },\n  \"homepage\": \"https://github.com/IlusionDev/nextjs-sitemap-generator\",\n  \"devDependencies\": {\n    \"@types/jest\": \"^24.0.25\",\n    \"@types/node\": \"^13.1.6\",\n    \"@typescript-eslint/eslint-plugin\": \"^2.15.0\",\n    \"@typescript-eslint/parser\": \"^2.15.0\",\n    \"eslint\": \"^6.8.0\",\n    \"eslint-config-airbnb-base\": \"^14.0.0\",\n    \"eslint-config-standard\": \"^14.1.0\",\n    \"eslint-plugin-import\": \"^2.20.0\",\n    \"eslint-plugin-jest\": \"^23.4.0\",\n    \"eslint-plugin-node\": \"^11.0.0\",\n    \"eslint-plugin-promise\": \"^4.2.1\",\n    \"eslint-plugin-standard\": \"^4.0.1\",\n    \"husky\": \"^4.0.6\",\n    \"jest\": \"^24.9.0\",\n    \"mockdate\": \"^2.0.5\",\n    \"prettier\": \"^1.19.1\",\n    \"ts-jest\": \"^24.3.0\",\n    \"typescript\": \"^3.7.4\"\n  },\n  \"files\": [\n    \"lib/**/*\"\n  ]\n}\n"
  }
]