Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@recursyve/scully-sitemap

Package Overview
Dependencies
Maintainers
4
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@recursyve/scully-sitemap

A Scully routeDiscoveryDone plugin for generating xml sitemaps.

  • 1.2.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
112
decreased by-13.18%
Maintainers
4
Weekly downloads
 
Created
Source

scully-plugin-sitemap

This routeDiscoveryDone plugin for Scully that will generate one or more sitemaps for your generated routes.

Installation

To install this library with npm run

$ npm install @recursyve/scully-sitemap --save-dev

Dependencies

The following peer dependencies are must be installed separately. Most are installed when install Angular or Scully. You'll likely only need to worry about fast-xml-parser and xmlbuilder.

  "peerDependencies": {
  "@scullyio/scully": "^2.1.14",
  "fast-xml-parser": "^4.0.3",
  "path-to-regexp": "^6.2.0",
  "xmlbuilder": "^15.1.1"
  },	

Usage

Within your Scully config (typescript), get and configure the plugin like so:

import { ScullyConfig, setPluginConfig } from '@scullyio/scully';
import { getSitemapPlugin } from '@gammastream/scully-sitemap';


const SitemapPlugin = getSitemapPlugin();
setPluginConfig(SitemapPlugin, {
    urlPrefix: 'https://gamma.stream',
    sitemapFilename: 'sitemap.xml',
    merge: false,
    trailingSlash: false,
    changeFreq: 'monthly',
    priority: ['1.0', '0.9', '0.8', '0.7', '0.6', '0.5', '0.4', '0.3', '0.2', '0.1', '0.0'],
    ignoredRoutes: ['/404'],
    routes: {
        '/products/:productId': {
            changeFreq: 'daily',
            priority: '0.9',
            sitemapFilename: 'sitemap-products.xml',
            merge: true
        },
    }
});

export const config: ScullyConfig = {
  projectRoot: './src',
  projectName: 'scully-plugins',
  outDir: './dist/static',
  routes: {
    '/products/:productId': {
        type: 'json',
        productId: {
            url: 'http://localhost:4200/assets/products.json',
            property: 'id',
        }
    }
  }
};

Build app and run scully like normal.

npm run build
npm run scully

Configuring Priority

The priority of a route can be configured by setting the priority level based on the number of segments in a given route.

[
	'1.0', // `/` - [ '' ] (1 segment)
	'0.9', // `/services` - [ '', 'services' ] (2 segments)
	'0.8', // `/services/hosting` - [ '', 'services', 'hosting' ]
	// etc...
]

Partial Generation with --routeFilter

Setting the merge flag to true causes the generated routes to be merged into the existing sitemap file (if there is one). This allows users to generate a subset of routes without overwriting previously generated routes within the sitemap.

	// excerpt
    routes: {
        '/products/:productId': {
            changeFreq: 'daily',
            priority: '0.9',
            sitemapFilename: 'sitemap-products.xml',
            merge: true
        },
    }

SEO Optimization & Trailing Slash

Setting the trailingSlash flag to true causes the url to be suffixed with a /. This is useful for SEO. You can set it for the main config or for individual routes.

const SitemapPlugin = getSitemapPlugin();
setPluginConfig(SitemapPlugin, {
    urlPrefix: 'https://your.site',
    sitemapFilename: 'sitemap.xml',
    merge: false,
    trailingSlash: true,
});

Keywords

FAQs

Package last updated on 23 Feb 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