Socket
Socket
Sign inDemoInstall

sitemap-static

Package Overview
Dependencies
2
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    sitemap-static

generate a sitemap for a static website


Version published
Weekly downloads
116
decreased by-10.08%
Maintainers
1
Install size
53.5 kB
Created
Weekly downloads
 

Changelog

Source

0.4.4 (2018-08-23)

<a name="0.4.3"></a>

Readme

Source

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 prettyPretty
http://www.example.com/index.htmlhttp://www.example.com/
http://www.example.com/about.htmlhttp://www.example.com/about
http://www.example.com/author/index.htmlhttp://www.example.com/author
http://www.example.com/author/main.htmlhttp://www.example.com/author/main

Example Command:

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

Keywords

FAQs

Last updated on 23 Aug 2018

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc