0.2.1 • Published 3 years ago

sitemap2urllist v0.2.1

Weekly downloads
1,005
License
MIT
Repository
github
Last release
3 years ago

Sitemap to Urllist

Simple sitemap.xml to urllist.txt converter

What & Why

What is sitemap.xml? sitemaps.org describes it well. It is a xml file that lists your subpages along with some metadata. It is used mainly for SEO. You probably already know it.

What is urllist.txt? It's basically a plain text sitemap, 1 line for 1 url (no other metadata). It was used by Yahoo! search engine back in the days. Now it is not used by anyone noteworthy AFAIK.

So why bother? I have found it is great for easy high-level testing of your website, like:

  • Example with webhint: curl https://example.com/urllist.txt | xargs -n1 hint
  • Example with broken-link-checker: curl https://example.com/urllist.txt | xargs -n1 blc

Installation

npm install --save-dev sitemap2urllist

Usage

CLI

$ sitemap2urllist --help
Options:
  --help, -h     Show usage                                            [boolean]
  --version, -V  Show current version                                  [boolean]
  --file, -f     Input file path              [string] [required] [default: "-"]
  --output, -o   Output file path             [string] [required] [default: "-"]

Library

JavaScript:

const sitemap2urllist = require('sitemap2urllist').sitemap2urllist;
const urllist = sitemap2urllist(...);
fs.writeFileSync('./sitemap.txt', urllist);

TypeScript (types are included):

import { sitemap2urllist } from 'sitemap2urllist';
const urllist: string = sitemap2urllist(...);
fs.writeFileSync('./sitemap.txt', urllist);

Alternatives

I could not find anything available to run locally (in a form of cli/app).

Examples

I am successfully using this package on my website at matejkosiarcik.com to generate urllist.txt from sitemap.xml (repository for more info).

License

The project is licensed under MIT License. See LICENSE for full details.

Changes

Changes in released versions are recorded in CHANGELOG.