Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

static-sitemap-cli

Package Overview
Dependencies
Maintainers
1
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

static-sitemap-cli

Simple CLI to pre-generate XML sitemaps for static sites locally.

  • 0.1.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
257
increased by84.89%
Maintainers
1
Weekly downloads
 
Created
Source

static-sitemap-cli

Simple CLI to pre-generate XML sitemaps for static sites locally.

Built in 10 minutes. :stuck_out_tongue_winking_eye:

Install

npm i -g static-sitemap-cli

Usage

Syntax: static-sitemap-cli <BASEURL> <options>

At its simplest, just go to your dist folder and run:

static-sitemap-cli https://example.com > sitemap.xml

By default outputs to stdout. So that you can pipe it to do other stuff.

Arguments

ArgumentDescription
BASEURLBase URL that is prefixed to all location entries. For example: https://example.com/

Options

OptionLongDescription
-h--helpshow CLI help
-v--versionshow CLI version
-r--root[default: .] root dir to start from
-m--match[default: .html] comma-separated list of extensions to match
-i--ignore[default: 404.html] comma-separated list of globs to ignore
-p--prioritycomma-separated glob/priority pair; eg: foo/*.html,0.1
-f--changefreqcomma-separated glob/changefreq pair; eg: foo/*.html,daily
-n--no-cleandisable clean URLs
-s--slashadd trailing slash to all URLs
Clean URLs

Whether or not to include the .html extension. By default, something like:

https://example.com/foo/index.html becomes https://example.com/foo.

Pass -n option to disable this behavior.

Trailing Slashes

Control whether or not URLs should include trailing slashes. For example:

https://example.com/bar/index.html becomes https://example.com/bar/.

For obvious reasons, this cannot be used together with -n.

Examples

Create sitemap for dist/ folder
static-sitemap-cli https://example.com -r dist/ > dist/sitemap.xml

Note: Just put dist/ for that location, not dist/. or ./dist/**.

Ignore a bunch of files
static-sitemap-cli https://example.com -i 404.html,foo/*.html > sm.xml
Set priority of certain pages

By default, the optional <priority> label (protocol reference) is excluded, so every pages' default is 0.5. To change the relative priority (to 0.1) of certain pages:

static-sitemap-cli https://example.com -p **/privacy-policy/**,0.1 **/terms-of-service/**,0.1 > sm.xml

To-do

Add tests! :sweat_smile:

Changelog

v0.1.0 - 2019-07-26:

  • Initial release.

Keywords

FAQs

Package last updated on 26 Jul 2019

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc