npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

metalsmith-sitemap

v1.2.2

Published

A metalsmith plugin for generating a sitemap.xml file.

Downloads

2,239

Readme

metalsmith-sitemap

npm version Build Status

A metalsmith plugin for generating a sitemap

This plugin allows you to generate a sitemap.xml from your source files. By default it looks for any .html files and processes them with sitemap.js.

Installation

$ npm install metalsmith-sitemap

Example

Configuration in metalsmith.json:

{
  "plugins": {
    "metalsmith-sitemap": {
      "hostname": "http://www.website.com"
    }
  }
}

Options

You can pass options to metalsmith-sitemap with the Javascript API or CLI. The options are:

hostname
  • required

The hostname used for generating the urls.

changefreq
  • optional
  • default: weekly

Change the default changefreq.

pattern
  • optional
  • default: '**/*.html'

A multimatch pattern. Only files that match this pattern will be included in the sitemap. Can be a string or an array of strings.

priority
  • optional
  • default: '0.5'

Change the default priority.

output
  • optional
  • default: 'sitemap.xml'

Change the output file for the sitemap.

lastmod
  • optional

Add a lastmodified date to the sitemap. Should be a Date object and can be passed through the Javascript API or the frontmatter.

links
  • optional

Allows you to define alternate language pages. This accepts nested properties in dot notation via lodash.get.

omitExtension
  • optional
  • default: false

Will remove extensions from the urls in the sitemap. Useful when you're rewriting urls.

omitIndex
  • optional
  • default: false

Will replace any paths ending in index.html with ''. Useful when you're using metalsmith-permalinks.

modifiedProperty
  • optional
  • default: lastmod

Allows you to choose which property to use as the last modified string. This accepts nested properties in dot notation via lodash.get.

urlProperty
  • optional
  • default: canonical

Allows you to choose which property to use as the canonical url in the frontmatter. This accepts nested properties in dot notation via lodash.get.

privateProperty
  • optional
  • default: private

Allows you to choose which property to use for ignoring a file in the frontmatter. This accepts nested properties in dot notation via lodash.get.

priorityProperty
  • optional
  • default: priority

Allows you to choose which property to use for your sitemap priority in the frontmatter. This accepts nested properties in dot notation via lodash.get.

Frontmatter

Some values can also be set on a file-to-file basis from a file's frontmatter, the options are:

  • canonical: will override the filename used to generate the url. The path is relative to the hostname.
  • changefreq: will override any other settings for changefreq for the current file.
  • lastmod: will override any other settings for lastmod for the current file.
  • priority: will override any other settings for priority for the current file.
  • private: will exclude the file from the sitemap when set to true.

For example:

---
canonical: 'different'
changefreq: always
lastmod: 2014-12-01
priority: 1.0
private: true
---
<!-- index.html -->

License

MIT