Closed marcjulian closed 3 years ago
Export SitemapConfig to improve type-safety in the scully.app.config.ts
SitemapConfig
scully.app.config.ts
Currently the sitemap config is added like
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 }, } });
If SitemapConfig is export it could be used to make sitemapConfig type-safe:
import { getSitemapPlugin, SitemapConfig } from '@gammastream/scully-plugin-sitemap'; const SitemapPlugin = getSitemapPlugin(); const sitemapConfig: SitemapConfig = { 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 }, } }; setPluginConfig(SitemapPlugin, sitemapConfig);
I like it @marcjulian. I'll make sure to do that in the next release. Thank you!
@marcjulian. I've exported the SitemapConfig interface and updated the package to 1.0.5.
1.0.5
Export
SitemapConfig
to improve type-safety in thescully.app.config.ts
Currently the sitemap config is added like
If
SitemapConfig
is export it could be used to make sitemapConfig type-safe: