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

routify-plugin-sitemap

v1.4.2

Published

A routify plugin to generate a sitemap.xml file.

Downloads

13

Readme

routify-plugin-sitemap

This plugin generates a sitemap.xml file for your website that makes use of Routify.

Usage

In your config insert:

import genSitemap from 'routify-plugin-sitemap';
// ...
  routify({
      plugins: [genSitemap({
        baseUrl: 'https://example.com'
      })]
    })

Advanced example:

  routify({
      plugins: [genSitemap({
        baseUrl: 'https://example.com',
        dir: 'public',
        static: [
          {
            loc: '/staticpage',
            changefreq: 'monthly',
            priority: '1.0',
            lastmod: 'November 16 2021 12:00 AM'
          }
        ],
        exclude: ['/hidden'],
        hreflang: ['en-gb'],
        baseUrlLang: ['uk'],
        urlLangType: 'subpage',
        robotsTxt: true
      })]
    })

Options

baseUrl is the only required option. All other options are optional.

baseUrl

Set this option to insert your domain before a page's path. A page's path begins with a slash, like /about. Thus baseUrl should not end in a slash. So if your domain is https://example.com, and one of your pages is at /about, it will appear in sitemap.xml as https://example.com/about.

dir

Set this to the directory in your project you would place static files. By default, this is set to public.

static

This is an array of objects, each equivalent to a sitemap's url entry. It accepts as properties loc, priority, lastmod, and changefreq. loc should be in the format /page; it is prefixed with baseUrl. lastmod must only be parsable by JavaScript's Date class.

exclude

This is an array of strings, each one the path to a file created by Svelte/Routify that you do not want to be added to the sitemap. Format each path like /path. Basically a blacklist.

include

This is an array of strings, each one the path to a file created by Svelte/Routify that you only want to be added to the sitemap. Format each path like /path. Basically a whitelist. Paths in both exclude and include will be excluded. Paths in static but not in include are still included.

hreflang

This is an array of strings, each one should be a valid language/region code.

baseUrlLang

This is an array of strings, each one corresponding to the value in hreflang of the same index. This is the string used to modify baseUrl.

urlLangType

This is a string which can be either of these values:

  • subpage - appends baseUrlLang to baseUrl as a subpage ('https://www.example.com/uk/')
  • domain - replaces baseUrl. ('https://www.example.co.uk/')

robotsTxt

This option, when set to true, causes the plugin to append a line containing the Sitemap URL to robots.txt. Default is false. If robots.txt does not exist, it will be created.

Tips

Check out Search Engine Journal's article about sitemap.xml files to learn more.