Skip to content
This repository has been archived by the owner on Mar 30, 2021. It is now read-only.

A DEPRECATED parcel plugin for creating basic sitemaps

License

Notifications You must be signed in to change notification settings

Tom-Julux/parcel-plugin-sitemap

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

57 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Deprecated

I have no intend to further develop this and especially not to be compatible with Parcel 2. As stated in the Disclaimer you can easily create a better sidemap by hand (and should do so). I deprecated the npm package and will delete it in a about a year or once it reaches 0 downloads per week.

Parcel Sitemap Plugin

A parcel plugin for creating (very) basic sitemaps.

Disclaimer:

This plugin will not create a fully featured sitemap, but the most basic one, that is still valid. Parcel makes it generally very easy for you to create a sitemap manually, as html files keep their names while beeing processed. So if you want to achieve perfect SEO optimization you should not use this plugin but create a sitemap manually.

However, if you just want to make sure all pages are listed so that search engines can crawl them, this plugin has you covered.

Installation

npm install parcel-plugin-sitemap

Usage

Add the following snippet to your package.json file and replace "https://www.example.org/" with the location where your site will be hosted:

{
    "sitemap": {
        "siteURL": "https://www.example.org/"
    }
}

Alternatively the homepage key can be used as a comfort options:

{
    "homepage": "https://www.example.org/"
}

Excluding

Files can be excluded from being added to the sitemap by specifying globs in the respective package.json field. The glob(s) will be negated and passed to fast-glob under the hood.

"sitemap": {
    "siteURL": "https://www.example.org/",
    "exclude": "static/**/*",
    /* Using an array of globs */
    "exclude": [
        "static/**/*",
        "exclude.html"
    ]
}

Timing (using with a prerenderer)

In certain cases the sitemap generation should wait until a prerenderer has finished execution. This is a timing issue, that is out of scope for this project. You should wait until the parcel process has exited and then use another tool or script to build your sitemap. So if your sitemap tool is called "sitemap-generator" you should modify your build-command to read somthing similar to

npm run build && sitemap-generator

License

MIT License