sitemap-static
generate a sitemap for a static website
Last updated 8 years ago by tmcw .
ISC · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install sitemap-static 
SYNC missed versions from official npm registry.

sitemap-static

CircleCI Greenkeeper badge

Make a sitemap for a static website based on files on disk

install

npm install -g sitemap-static

usage

Use in the root directory of the files on the site. This will only add files with .html extensions to the sitemap.

sitemap-static --prefix=http://foo.bar/foo/ . > sitemap.xml

library API

var generateSitemap = require('sitemap-static');
var fs = require('fs');

var writer = fs.createWriteStream('/path/to/your/sitemap.xml');

generateSitemap(writer, {
    findRoot: '.',
    ignoreFile: '',
    prefix: 'http://somesi.te/',
    pretty: false
})

Ignore File

Added in v0.0.1 you can pass the name of a json file to load. File file needs to be in your current working directory and should be an array of file names (without the / at the front) that you want ignored. You can ignore entire directories by leaving off the .html. Example JSON:

[
	"ignore-me.html",
	"ignore-everything-in-me/"
]

Example Command:

sitemap-static --ignore-file=ignore.json --prefix=http://foo.bar/foo/ . > sitemap.xml

Pretty URLs

If you pass --pretty to the CLI (or pretty: true to the JS API), sitemap-static will output pretty URLs rather than the whole path to each file. For example:

Not pretty Pretty
http://www.example.com/index.html http://www.example.com/
http://www.example.com/about.html http://www.example.com/about
http://www.example.com/author/index.html http://www.example.com/author
http://www.example.com/author/main.html http://www.example.com/author/main

Example Command:

sitemap-static --prefix=http://foo.bar/foo/ --pretty . > sitemap.xml

Current Tags

  • 0.4.4                                ...           latest (8 years ago)

11 Versions

  • 0.4.3                                ...           8 years ago
  • 0.4.2                                ...           9 years ago
  • 0.4.1                                ...           9 years ago
  • 0.4.0                                ...           9 years ago
  • 0.3.2                                ...           9 years ago
  • 0.4.4                                ...           8 years ago
  • 0.3.1                                ...           10 years ago
  • 0.3.0                                ...           11 years ago
  • 0.2.0                                ...           11 years ago
  • 0.1.0                                ...           12 years ago
  • 0.0.0                                ...           12 years ago
Maintainers (1)
Downloads
Today 0
This Week 1
This Month 5
Last Day 1
Last Week 4
Last Month 0
Dependencies (2)
Dev Dependencies (4)
Dependents (1)

Copyright 2013 - present © cnpmjs.org | Home |