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

@dots.dev/plugin-sitemap

v0.8.1

Published

Automatically generate a sitemap for your site after it finishes building in Netlify.

Downloads

5

Readme

Netlify sitemap plugin

Automatically generate a sitemap for your site after it finishes building in Netlify.

Installation

You can install this plugin in the Netlify UI from this direct in-app installation link or from the Plugins directory.

To use file-based installation, add the following lines to your netlify.toml file:

[[plugins]]
package = "@netlify/plugin-sitemap"

Note: The [[plugins]] line is required for each plugin, even if you have other plugins in your netlify.toml file already.

To complete file-based installation, from your project's base directory, use npm, yarn, or any other Node.js package manager to add this plugin to devDependencies in package.json.

npm install -D @netlify/plugin-sitemap

Configuration

By default, the plugin generates a sitemap based on the publish directory configured in your site build settings or netlify.toml. To change the default behavior use the buildDir configuration.

[[plugins]]
package = "@netlify/plugin-sitemap"

  [plugins.inputs]
  buildDir = "public"

Writing to a subfolder path

If your site is meant to be served from a subfolder, you can also apply the filePath parameter in order to place the sitemap.xml in a particular location within in the buildDir. NOTE: this parameter must contain the full file name including "sitemap.xml".

[[plugins]]
package = "@netlify/plugin-sitemap"

  [plugins.inputs]
  buildDir = "public"
  filePath = "some/subfolder/sitemap.xml"

Excluding files from sitemap

[[plugins]]
package = "@netlify/plugin-sitemap"

  [plugins.inputs]
  buildDir = "public"
  exclude = [
    # By file Path
    './build-dir/path-to/file.html',
    # By Glob pattern
    '**/**/child-one.html'
  ]

Pretty URLs

Pretty urls a.k.a. site.com/index.html being turned into site.com/ is on by default.

To disable this feature set the prettyURLs option to false

[[plugins]]
package = "@netlify/plugin-sitemap"

  [plugins.inputs]
  buildDir = "public"
  # disable pretty URLS and keep `index.html` & trailing `.html` file references in paths
  prettyURLs = false

When using pretty URLs, missing trailing slashes can be appended by setting the trailingSlash option to true. This renders site.com/page-one.html as site.com/page-one/.

[[plugins]]
package = "@netlify/plugin-sitemap"

  [plugins.inputs]
  buildDir = "public"
  prettyURLs = true
  # Append missing trailing slash to pretty URL
  trailingSlash = true

Set the default values for "changefreq" and "priority"

[[plugins]]
package = "@netlify/plugin-sitemap"

  [plugins.inputs]
  changeFreq = "daily"
  priority = 0.5

Set base URL from environment variable rather than plugin input

You can include an environment variable (NETLIFY_PLUGIN_SITEMAP_BASEURL) in your Netlify site to set the base URL that will be used by the plugin. This option is useful if the baseUrl plugin input can't be used. Example use case: different Netlify sites built from the same repository and don't/can't have custom domains.

Priority of base URL assignment: plugin input baseUrl -> env NETLIFY_PLUGIN_SITEMAP_BASEURL -> Netlify site default URL

[[plugins]]
package = "@netlify/plugin-sitemap"

  [plugins.inputs]
  baseUrl = "http://example.com"

NOTE: Although the above is called base URL this actually ends up being the hostname in the sitemap and as such trying to use a URL like http://example.com/en/ will results in http://example.com/

Add a prefix to the URL

You can include an environment variable (NETLIFY_PLUGIN_SITEMAP_URL_PREFIX) in your Netlify site to set the URL prefix that will be used by the plugin. This option is useful if the urlPrefix plugin input can't be used. Example use case: different Netlify sites built from the same repository and don't/can't have custom domains.

Priority of base URL assignment: plugin input urlPrefix -> env NETLIFY_PLUGIN_SITEMAP_URL_PREFIX

[[plugins]]
package = "@netlify/plugin-sitemap"

  [plugins.inputs]
  urlPrefix = "/en/"