New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

fs-sitemap-generator

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fs-sitemap-generator

Tool for generating sitemap.xml based on folder structure

  • 1.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

FS Sitemap Generator

Package on npm

Table of Contents

Introduction

This package uses the fs to generate an XML sitemap. This is useful for when you're dealing with SSR generated websites which don't natively support an on the fly sitemap generation.

In most cases this script can be executed as an additional command after the build (tested and verified on Netlify) and can then be submitted to search engines.

Requirements

You need nodeJS to run the script (but you'd probably have it installed anyway). Also, create a file to execute (see example.js).

Usage

Install with the following command:

npm i fs-sitemap-generator

You should add the action of generating the sitemap after the SSR generation has taken place. You only need to do this on the deployment. In the example the contents of example.js would have been stored on sitemap.js.

For instance, you can simply enter:

npm generate && node example

Methods

There's only one method and it takes a couple of arguments as configuration.

generateSitemap

Reads into the file system of the specified folder and assumes that all folders point to a servable index file (which most SSR generators will provide):

NameTypeDescription
sourceFolderStringThe folder where the SSR generated content is stored
ignoreFoldersArrayList of foldernames to ignore while generating
domainStringMain domain to build a full URL
outputFileStringDestination file (usually a combination of sourceFolder + sitemap.xml
generateSitemap(
    SOURCE_FOLDER,
    IGNORE_FOLDERS,
    DOMAIN,
    OUTPUT_FILE
  );

Contributing

If you want to contribute, feel free to drop me a line or open up an Issue on the repo. Then we can discuss how the change would fit in with the code.

Disclaimer

It's a simple script which is based on a lot of assumptions of a standard build. It may not suit more custom scenarios but that was never the intention.

Keywords

FAQs

Package last updated on 09 Nov 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc