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

sitemap-b-framework

v1.2.8

Published

Advanced Sitemap Management, Generating & Deployment Framework

Downloads

6

Readme

Node.js Package

Sitemap B Framework

Advanced Sitemap Management, Generating & Deployment Framework [Open Source]

More info on sitemaps here

Note: General Availability (GA) Now

Installation

npm i sitemap-b-framework --save

https://www.npmjs.com/package/sitemap-b-framework

Features

  • Simple and Advanced Sitemap with Index supported
  • Auto Deploy Generated Sitemap to S3 or Google Cloud Storage Buckets
  • Persistent Local JSON File as Database
  • Auto Build and Deploy to Buckets or Local Storage with Manual Trigger and CRON
  • Backup Sitemap JSON DB and Sitemap XML to Buckets with Manual Trigger and CRON
  • Webpages, Image, Video, News Sitemap Supported
  • Sitemap Links with Limit and Locking Constraints In Options

Usage

Simple Usage

var sitemapBFramework = require("sitemap-b-framework");
var SitemapBFramework = new sitemapBFramework();

// sitemapItemAdd(itemLoc, sitemapName @optional, lastmod @optional, changefreq @optional, priority @optional);
const data = await SitemapBFramework.sitemapItemAdd('https://example.com/product/laptop');
const data = await SitemapBFramework.sitemapBuildAndDeploy();

// Sitemap XML files will be generated at ./sitemap-xml/build folder;

Advanced Usage

var sitemapBFramework = require("sitemap-b-framework");
// Refer options in heading below for more documentation
const options = {
  path:'data/sitemap',
  maxLinksPerSitemap: 50000,
  build:{ 
    cron: '0 1 * * *',
    deployToBucket: {
      s3: {
        accessKeyId: "Access Key ID",
        secretAccessKey: "Secret Key",
        bucket: "Name of Bucket",
        path: "Path Inside Bucket",
        makePublic: true | false,
      },
    }
  }
}
var SitemapBFramework = new sitemapBFramework(options);

 /*
 Add sitemap index file for multiple sitemaps
 sitemapIndexAdd(sitemapName, loc, type @optional, limit @optional, locked @optional);
 sitemapName = sitemapName
 loc = location url
 type = webpages,news,image,video
 limit = 0 to 50000
 locked = true or false // default false - Avoid inserting ,updating or deleting a sitemap items.
 build_deploy = true or false // default true - Make to false once deployed for very large or not mostly changing sitemap files. 
 */
 await SitemapBFramework.sitemapIndexAdd('sitemap-products','https://sitemap/sitemap-products.xml','webpages',50000,false, true);

 /*
 Add sitemap links to each sitemap file
 sitemapItemAdd(itemLoc, sitemapName @optional, lastmod @optional, changefreq @optional, priority @optional);
 sitemapName = sitemapName
 itemLoc = each item location
 lastmod = Last Modified Date YYYY-MM-DD
 changefreq = always, hourly, daily, weekly, monthly, yearly, never
 priority = 0.1 to 1.0 
 */
 await SitemapBFramework.sitemapItemAdd('https://example.com/product/laptop','sitemap-products','2020-05-10','monthly',0.5);


 /*
 Build Sitemap Index and  Sitemap Files and Deploy To Buckets - AWS S3 or GCP GCS
 sitemapBuildAndDeploy();
 - Sitemap generated at default folder  ./sitemap-xml/build , Can be overridden in option parameters
 - Deploying To Buckets depends on options parameters
 - Auto Build can be trigger on cron parameters in options
 */
 await SitemapBFramework.sitemapBuildAndDeploy();

 /*
 Notes:
 - Default path for framework data stored as json files at ./sitemap-config
 - Default path for lastest generated sitemap files are stored at ./sitemap-xml/build
 - Persistent storage requires for ./sitemap-config path for all operations
 */

Options Allowed

const options = {
  path: 'data/sitemap', // Persistent folder location, optional
  maxLinksPerSitemap: 15000, // Max of 50000 links allowed per sitemap file, optional
  build: { // optional
    cron: "Cron Expression to auto build sitemap files and deploy to bucket if defined",  // optional
    deployToBucket: { // optional
      gcs: {
        projectId: "GCP Project ID",
        service_account_key_path: "Path to gcp service account json file",
        bucket: "Name of Bucket",
        path: "Path Inside Bucket",
        makePublic: true | false,
      },
      s3: {
        accessKeyId: "Access Key ID",
        secretAccessKey: "Secret Key",
        bucket: "Name of Bucket",
        path: "Path Inside Bucket",
        makePublic: true | false,
      },
    }
  },
  backup: {  // optional
    cron: "Cron Expression to auto backup framework data and sitemap xml files to bucket if defined",  // optional
    bakcupToBucket: { // optional
      gcs: {
        projectId: "GCP Project ID",
        service_account_key_path: "Path to gcp service account json file",
        bucket: "Name of Bucket",
        path: "Path Inside Bucket"
      },
      s3: {
        accessKeyId: "Access Key ID",
        secretAccessKey: "Secret Key",
        bucket: "Name of Bucket",
        path: "Path Inside Bucket"
      },
    }
  }
};

Methods Available


 //sitemapIndexAdd(sitemapName, loc, type @optional, limit @optional, locked @optional, build_deploy @optional);
 sitemapIndexAdd('sitemap-products', 'https://sitemap/sitemap-products.xml', 'webpages', 50000, false, true);

 
 //sitemapIndexUpdate(sitemapName, loc, type @optional, limit @optional, locked @optional, build_deploy @optional);
 sitemapIndexUpdate('sitemap-products', 'https://sitemap/sitemap-products-new.xml', 'webpages', 50000, false, true);


 //sitemapIndexDelete(sitemapName);
 sitemapIndexDelete('sitemap-products');


 //sitemapIndexList();
 sitemapIndexList();


 //sitemapItemAdd(itemLoc, sitemapName @optional, lastmod @optional, changefreq @optional, priority @optional);
 sitemapItemAdd('https://example.com/product/laptop', 'sitemap-products', '2020-05-10', 'monthly', 0.5);

 
 //sitemapItemAdd(olditemLoc, itemLoc , sitemapName @optional, lastmod @optional, changefreq @optional, priority @optional);
 sitemapItemUpdate('https://example.com/product/laptop', 'https://example.com/product/laptop-trending', 'sitemap-products', '2020-05-10', 'daily', 0.9);

 
 //sitemapItemDelete(itemLoc, sitemapName @optional);
 sitemapItemDelete('https://example.com/product/laptop-trending', 'sitemap-products', );


 //sitemapItemList(sitemapName @optional);
 sitemapItemList('sitemap-products');
 

 //sitemapGlobalSearch(loc);
 sitemapGlobalSearch('https://example.com/product/laptop-trending');


 //sitemapBuildAndDeploy();
 sitemapBuildAndDeploy();


 //BackupToBucket();
 BackupToBucket();

Maintainers

Contributors are welcome

License

See LICENSE file.

Note: General Availability (GA) Now