express-sitemap
Sitemap and Robots for expressjs 3 and 4
Installation
Install through NPM
npm install express-sitemap
or
git clone git://github.com/hex7c0/express-sitemap.git
API
inside expressjs project
var sitemap = ; var app = ; sitemap;
Methods
if you want generate your own url
var sitemap = ; ;
and this will be sitemap.xml
http://127.0.0.1/foo 2014-06-19 always 1 http://127.0.0.1/foo2
and this will be robots.txt
User-agent: *Disallow: /admin
reset prototype Object for sitemap
sitemap;
generate sitemap (wrapper)
sitemap;
generate sitemap from express 4.x configuration. Add an array with Router path if you want use nested callback
sitemap;
generate sitemap from express 3.x configuration
sitemap;
generate prototype Object for sitemap if you use middleware or dynamic building
sitemap;
write sitemap Object to file (set pathname inside module configuration or like argument)
sitemap;
write robots.txt to file (set pathname inside module configuration or like argument)
sitemap;
write both to files
sitemap;
stream sitemap to web
sitemap;
stream robots.txt to web
sitemap;
sitemap(options)
options
http
- String Website HTTP protocol (http | https) (default "http")cache
- Integer Enable cache integration, refresh map after this millisecond value (default "false")url
- String Website URL (default "127.0.0.1")port
- Number Website Port (default "80")sitemap
- String Name of sitemap file (default "sitemap.xml")robots
- String Name of robots file (default "robots.txt")sitemapSubmission
- String SetSitemap
absolute location into robots (default "disable")route
- Object Add extra information to sitemap related to this documentation (default "disabled")lastmod
- Date Integrity not controlledchangefreq
- String Integrity not controlledpriority
- Float Integrity not controlledalternatepages
- Array Add alternate language pages related to this documentationrel
- String Integrity not controlledhreflang
- String Integrity not controlledhref
- String Integrity not controlled
allow
- Boolean Flag for "allow" this route from parsing, and save intorobots.txt
(default "null")disallow
- Boolean Flag for "disallow" this route from parsing, and save intorobots.txt
(default "null")hide
- Boolean Flag for hide this route from globally parsing (no .xml or .txt) (default "false")map
- Object Force route () detection and building (default "disabled")hideByRegex
- Array Array of RegEx that remove routes from output (default "disabled")generate
- Object Fastly generate sitemap from express app (default "disabled")
you can use route: {'ALL': {} }
if you want propagate extra information to all your urls
Examples
Take a look at my examples