{"id":21905393,"url":"https://github.com/hex7c0/express-sitemap","last_synced_at":"2025-04-24T04:11:15.780Z","repository":{"id":73262516,"uuid":"21008212","full_name":"hex7c0/express-sitemap","owner":"hex7c0","description":"sitemap and robots for Expressjs","archived":false,"fork":false,"pushed_at":"2024-04-22T23:55:50.000Z","size":514,"stargazers_count":67,"open_issues_count":9,"forks_count":15,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-04-23T00:49:43.564Z","etag":null,"topics":["express","nodejs","robot","sitemap"],"latest_commit_sha":null,"homepage":"https://github.com/hex7c0/express-sitemap","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hex7c0.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2014-06-19T16:52:12.000Z","updated_at":"2024-06-18T15:18:42.802Z","dependencies_parsed_at":"2024-04-23T00:47:29.922Z","dependency_job_id":"818b7a66-91a3-480a-94e4-986c9f5f52fa","html_url":"https://github.com/hex7c0/express-sitemap","commit_stats":{"total_commits":190,"total_committers":3,"mean_commits":"63.333333333333336","dds":"0.010526315789473717","last_synced_commit":"90e41ba0755ccfd7f9fcd93ede7eae9a089f99d1"},"previous_names":[],"tags_count":26,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hex7c0%2Fexpress-sitemap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hex7c0%2Fexpress-sitemap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hex7c0%2Fexpress-sitemap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hex7c0%2Fexpress-sitemap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hex7c0","download_url":"https://codeload.github.com/hex7c0/express-sitemap/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250560053,"owners_count":21450172,"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":["express","nodejs","robot","sitemap"],"created_at":"2024-11-28T16:33:10.585Z","updated_at":"2025-04-24T04:11:15.763Z","avatar_url":"https://github.com/hex7c0.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# [express-sitemap](https://github.com/hex7c0/express-sitemap)\n\n[![NPM version](https://img.shields.io/npm/v/express-sitemap.svg)](https://www.npmjs.com/package/express-sitemap)\n[![Linux Status](https://img.shields.io/travis/hex7c0/express-sitemap.svg?label=linux-osx)](https://travis-ci.org/hex7c0/express-sitemap)\n[![Windows Status](https://img.shields.io/appveyor/ci/hex7c0/express-sitemap.svg?label=windows)](https://ci.appveyor.com/project/hex7c0/express-sitemap)\n[![Dependency Status](https://img.shields.io/david/hex7c0/express-sitemap.svg)](https://david-dm.org/hex7c0/express-sitemap)\n[![Coveralls](https://img.shields.io/coveralls/hex7c0/express-sitemap.svg)](https://coveralls.io/r/hex7c0/express-sitemap)\n\nSitemap and Robots for [expressjs](http://expressjs.com/) 3 and 4\n\n## Installation\n\nInstall through NPM\n\n```bash\nnpm install express-sitemap\n```\nor\n```bash\ngit clone git://github.com/hex7c0/express-sitemap.git\n```\n\n## API\n\ninside expressjs project\n```js\nvar sitemap = require('express-sitemap')();\n\nvar app = require('express')();\n\nsitemap.generate(app);\n```\n\n### Methods\n\nif you want generate your own url\n```js\nvar sitemap = require('express-sitemap');\n\nsitemap({\n    map: {\n        '/foo': ['get'],\n        '/foo2': ['get','post'],\n        '/admin': ['get'],\n        '/backdoor': [],\n    },\n    route: {\n        '/foo': {\n            lastmod: '2014-06-20',\n            changefreq: 'always',\n            priority: 1.0,\n        },\n        '/admin': {\n            disallow: true,\n        },\n        '/backdoor': {\n            hide: true,\n        },\n    },\n}).XMLtoFile();\n```\n\nand this will be sitemap.xml\n```xml\n\u003curlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\"\u003e\n    \u003curl\u003e\n        \u003cloc\u003ehttp://127.0.0.1/foo\u003c/loc\u003e\n        \u003clastmod\u003e2014-06-19\u003c/lastmod\u003e\n        \u003cchangefreq\u003ealways\u003c/changefreq\u003e\n        \u003cpriority\u003e1\u003c/priority\u003e\n    \u003c/url\u003e\n    \u003curl\u003e\n        \u003cloc\u003ehttp://127.0.0.1/foo2\u003c/loc\u003e\n    \u003c/url\u003e\n\u003c/urlset\u003e\n```\n\nand this will be robots.txt\n```txt\nUser-agent: *\nDisallow: /admin\n```\n\nreset prototype Object for sitemap\n```js\nsitemap.reset();\n```\n\ngenerate sitemap (wrapper)\n```js\nsitemap.generate(app);\n```\n\ngenerate sitemap from express 4.x configuration. Add an array with Router path if you want use nested callback\n```js\nsitemap.generate4(app [, Router]);\n```\n\ngenerate sitemap from express 3.x configuration\n```js\nsitemap.generate3(app);\n```\n\ngenerate prototype Object for sitemap if you use middleware or dynamic building\n```js\nsitemap.tickle();\n```\n\nwrite sitemap Object to file (set pathname inside module configuration or like argument)\n```js\nsitemap.XMLtoFile([path]);\n```\n\nwrite robots.txt to file (set pathname inside module configuration or like argument)\n```js\nsitemap.TXTtoFile([path]);\n```\n\nwrite both to files\n```js\nsitemap.toFile();\n```\n\nstream sitemap to web\n```js\nsitemap.XMLtoWeb(res);\n```\n\nstream robots.txt to web\n```js\nsitemap.TXTtoWeb(res);\n```\n\n### sitemap(options)\n\n#### options\n\n - `http` - **String** Website HTTP protocol (http | https) *(default \"http\")*\n - `cache` - **Integer** Enable cache integration, refresh map after this millisecond value *(default \"false\")*\n - `url` - **String** Website URL *(default \"127.0.0.1\")*\n - `port` - **Number** Website Port *(default \"80\")*\n - `head` - **String** Head of XML file *(default \"\u003curlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\"\u003e\")*\n - `sitemap` - **String** Name of sitemap file *(default \"sitemap.xml\")*\n - `robots` - **String** Name of robots file *(default \"robots.txt\")*\n - `sitemapSubmission` - **String** Set `Sitemap` absolute location into robots *(default \"disable\")*\n - `route` - **Object** Add extra information to sitemap related to this [documentation](http://www.sitemaps.org/protocol.html#xmlTagDefinitions) *(default \"disabled\")*\n  - `lastmod` - **Date** Integrity not controlled\n  - `changefreq` - **String** Integrity not controlled\n  - `priority` - **Float** Integrity not controlled\n  - `alternatepages` - **Array** Add alternate language pages related to this [documentation](https://support.google.com/webmasters/answer/2620865)\n    - `rel` - **String** Integrity not controlled\n    - `hreflang` - **String** Integrity not controlled\n    - `href` - **String** Integrity not controlled\n  - `allow` - **Boolean** Flag for \"allow\" this route from parsing, and save into `robots.txt` *(default \"null\")*\n  - `disallow` - **Boolean** Flag for \"disallow\" this route from parsing, and save into `robots.txt` *(default \"null\")*\n  - `hide` - **Boolean** Flag for hide this route from globally parsing (no .xml or .txt) *(default \"false\")*\n - `map` - **Object** Force route (\u003cloc\u003e) detection and building *(default \"disabled\")*\n - `hideByRegex` - **Array** Array of RegEx that remove routes from output *(default \"disabled\")*\n - `generate` - **Object** Fastly generate sitemap from express app *(default \"disabled\")*\n\nyou can use `route: {'ALL': {} }` if you want propagate extra information to all your urls\n\n## Examples\n\nTake a look at my [examples](examples)\n\n### [License GPLv3](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhex7c0%2Fexpress-sitemap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhex7c0%2Fexpress-sitemap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhex7c0%2Fexpress-sitemap/lists"}