Security News
Combatting Alert Fatigue by Prioritizing Malicious Intent
In 2023, data breaches surged 78% from zero-day and supply chain attacks, but developers are still buried under alerts that are unable to prevent these threats.
@gammastream/scully-plugin-sitemap
Advanced tools
A Scully routeDiscoveryDone plugin for generating xml sitemaps.
This routeDiscoveryDone
plugin for Scully that will generate one or more sitemaps for your generated routes.
Version 1.0.0 introduces breaking changes as the plugin has been rewritten to take advantage of the new routeDiscoveryDone
plugin type rather the old way of using a render
plugin. This has the major benefit of only generating the sitemaps once per run – instead of after each page render.
To install this library with npm
run
$ npm install @gammastream/scully-plugin-sitemap --save-dev
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": "^1.0",
"fast-xml-parser": "^3.17.4",
"path-to-regexp": "^0.1.7",
"xmlbuilder": "^13.0.2"
},
Within your Scully config (typescript), get and configure the plugin like so:
import { ScullyConfig, setPluginConfig } from '@scullyio/scully';
import { getSitemapPlugin } from '@gammastream/scully-plugin-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
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...
]
Version 1.0.1 adds the merge
flag. Setting the 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
},
}
Version 1.0.2 adds the trailingSlash
flag. Setting the 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://gamma.stream',
sitemapFilename: 'sitemap.xml',
merge: false,
trailingSlash: true,
});
Currently, the default priority (0.5) is assigned to all routes. Planned for a future update is the ability to assign a priority based on the number of segments in a route. (Completed in v0.0.4)
Sitemap is regenerated with every route. At some time in the future, we expect Scully to support a class of plugins that run after it is finished generating all the routes. (Completed in v1.0.0)
If you have any issues you can raise them here or contact me at: GammaStream
FAQs
A Scully routeDiscoveryDone plugin for generating xml sitemaps.
We found that @gammastream/scully-plugin-sitemap demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
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.
Security News
In 2023, data breaches surged 78% from zero-day and supply chain attacks, but developers are still buried under alerts that are unable to prevent these threats.
Security News
Solo open source maintainers face burnout and security challenges, with 60% unpaid and 60% considering quitting.
Security News
License exceptions modify the terms of open source licenses, impacting how software can be used, modified, and distributed. Developers should be aware of the legal implications of these exceptions.