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

nuxt-mapple

v1.1.1

Published

Nuxt Mapple: Sitemap Generator

Downloads

57

Readme

Nuxt: Mapple - A Sitemap Generator

npm

This module will build and put a sitemap at /sitemap.xml using a combination of optional static, dynamic, and generated routes. All pages without parameters in their paths will be inserted automatically (i.e. pages/blog.vue), and when useContent is enabled, the content folder is scanned for .md files, and added to the sitemap.

Installation

yarn add nuxt-mapple

Add the module to your nuxt.config.ts: modules: ['nuxt-mapple'],

Usage

Exclude content with a Regular Expression

You can exclude paths (as well as separately/specifically content paths) from the sitemap by using a Regular Expression (with leading and trailing slashes):

defineNuxtConfig({
  mapple: {
    excludeAny: "(/early-signup|/u/*)",
    excludeContent: "^/(references/).*",
  }
})

Static Paths

You can list static paths manually in your nuxt.config.ts, in an array of relative paths:

defineNuxtConfig({
  mapple: {
    basePath: 'https://l422y.com',
    static: [
      '/projects/mtv/the-buried-life-storefront',
      '/projects/travelers/umbrella-hall',
      '/projects/mayo-clinic/mayo-clinic-memory-game',
      '/projects/f4w/tactica',
    ]
  }
})

Content Directory

or enable scanning of your content folder for .md files by enabling useContent and, optionally, including a filter for paths to exclude (example below will exclude /references/*):

defineNuxtConfig({
  mapple: {
    basePath: 'https://l422y.com',
    useContent: true,
    excludeContent: "^/(references/).*", // Regular Expression (with leading and trailing slashes)
  }
})

Build using templates and datasets

... or you can build based on route templates and datasets, using multi-dimensional arrays, i.e. a route template of /@/@ and a dataset like the following:

[
  ['blog', ['post-a', 'post-b', 'post-c']],
  ['projects', ['project-1', 'project-2', 'project-3']]
]

Our configuration would look something like this:

defineNuxtConfig({
  modules: ['nuxt-mapple'],
  mapple: {
    basePath: 'https://l422y.com',
    staticRoutes: ['/'],
    dynamicRoutes: [
      {
        route: '/@/@',
        data: [
          ['blog', ['post-a', 'post-b', 'post-c']],
          ['projects', ['project-1', 'project-2', 'project-3']]
        ]
      }
    ]
  }
})

Our sitemap.xml will look like this:

<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="https://www.sitemaps.org/schemas/sitemap/0.9">
  <url>
    <loc>https://l422y.com/blog/post-a</loc>
  </url>
  <url>
    <loc>https://l422y.com/blog/post-b</loc>
  </url>
  <url>
    <loc>https://l422y.com/blog/post-c</loc>
  </url>
  <url>
    <loc>https://l422y.com/projects/project-1</loc>
  </url>
  <url>
    <loc>https://l422y.com/projects/project-2</loc>
  </url>
  <url>
    <loc>https://l422y.com/projects/project-3</loc>
  </url>
  <url>
    <loc>https://l422y.com/</loc>
  </url>
</urlset>

Here's a full configuration example:

defineNuxtConfig({
  mapple: {
    basePath: 'https://l422y.com',
    dynamic: [
      {
        // single depth route template
        route: '/projects/@',
        // single depth dataset
        data: [
          'personal/musicmonitor',
          'disney/photo-video-kiosk',
        ]
      },
      {
        // double depth route template
        route: '/projects/@/@',
        // double depth dataset
        data: [
          ['personal',
            [
              'whatcd-releases-tracker',
              'music-shop-aggregator'
            ]
          ],
          ['monstermedia',
            [
              'flash-analytics',
              'monitoring-control-system',
              'hbo-unwrap',
            ]
          ],
        ]
      },
      {
        // single depth route template
        route: '/blog/@',
        // single depth dataset
        data: [
          'nuxt-adventures-1',
          'nuxt-adventures-2',
          'nuxt3-dynamic-social-images',
          'web3-endpoint-cycler',
          'wordpress-paywall',
        ]
      },
      {
        // single depth route template
        route: '/@',
        // single depth dataset
        data: [
          'projects',
          'experience',
          'skills',
          'references',
          'blog',
          'about'
        ]
      }
    ]

  }
})

Development

  • Run npm run dev:prepare to generate type stubs.

Credits

Made with 💚 by Larry Williamson / @l422y

Originally ideated from @benoitdemaegdt's nuxt3-sitemap