gammastream / scully-plugins Goto Github PK
View Code? Open in Web Editor NEWA collection of plugins written for Scully
A collection of plugins written for Scully
When we use the scully plugin seoHrefOptimise then the urls are rewritten with a slash at the end but the sitemap is still generated without the slash.
Hello. Thank you for the great plugin, I've been using it for over half a year and been quite happy, but now I am working on the multilanguage feature and I tried setting:
setPluginConfig(sitemapPlugin, {
urlPrefix: `https://example.com${BASE_HREF.replace(/\/$/, '')}`,
sitemapFilename: 'sitemap.xml',
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'],
});
And the result is this:
<?xml version="1.0"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>https://example.com/uk</loc>
<changefreq>monthly</changefreq>
<lastmod>2021-01-17T18:33:40.858Z</lastmod>
<priority>1.0</priority>
</url>
<url>
<loc>https://example.com/route1</loc>
<changefreq>monthly</changefreq>
<lastmod>2021-01-17T18:33:40.858Z</lastmod>
<priority>0.9</priority>
</url>
</urlset>
But what I expected is:
<?xml version="1.0"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>https://example.com/uk</loc>
<changefreq>monthly</changefreq>
<lastmod>2021-01-17T18:33:40.858Z</lastmod>
<priority>1.0</priority>
</url>
<url>
<loc>https://example.com/uk/route1</loc>
<changefreq>monthly</changefreq>
<lastmod>2021-01-17T18:33:40.858Z</lastmod>
<priority>0.9</priority>
</url>
</urlset>
So as you can see for non-root routes the /uk
part got stripped and that is not the right result for me.
Export SitemapConfig
to improve type-safety in the 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);
Hi, within the latest published scully version, the imports for e.g. @scullyio/scully/routerPlugins
has been moved to @scullyio/scully/lib/routerPlugins
.
Same with '@scullyio/scully/utils/log'
= >'@scullyio/scully/lib/utils/log'
.
This should be adjusted for all plugins
Using the latest version of Scully and @types/node
gives the following:
npm WARN @gammastream/[email protected] requires a peer of @scullyio/[email protected] but none is installed. You must install peer dependencies yourself.
npm WARN @gammastream/[email protected] requires a peer of @types/node@^7.10.10 but none is installed. You must install peer dependencies yourself.
npm WARN @gammastream/[email protected] requires a peer of tslib@^1.10.0 but none is installed. You must install peer dependencies yourself.
I'm not sure if there is a specific reason for requiring the old version of NodeJS types and not something that supports the latest ("@types/node": "^14.0.27",
)?
Scully 1.0.0-beta.0
is now available and is marked as not supported by 1.0.2
of this library.
I know that Scully had issues with [email protected]
, but it's something that it will need to support at some point (and the beta may have fixed this). But this library doesn't support this new tslib version.
Thank you for your work in maintaining this useful plugin!
Ideally, I'd like to have something like this
monthly
daily
weekly
or monthly
I guess that this could be done via globs, but I'm not sure where. Possibly in the Scully config file.
It would be nice to have something similar for priorties too.
Warning: Entry point '@gammastream/scully-plugin-http404' contains deep imports into '/node_modules/@scullyio/scully/lib/utils/config'.
This is probably not a problem, but may cause the compilation of entry points to be out of order.
I updated the sitemap plugin to use the newly exported SitemapConfig
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);
The types for routes
is not matching as it is declared as any[]
array.
Error from VSCode
Type '{ '/products/:productId': { changeFreq: string; priority: string; sitemapFilename: string; merge: true; }; }' is not assignable to type 'any[]'.
Object literal may only specify known properties, and ''/products/:productId'' does not exist in type 'any[]'.ts(2322)
sitemap-config.d.ts(20, 5): The expected type comes from property 'routes' which is declared here on type 'SitemapConfig'
Hi!
Great plugin, I'd really like to use it. However, for my workflow I need to be able to do partial (or delta runs) of Scully. Basically I do a full run of Scully, but then, when for example only a single product in my DB updated, I run Scully with the --routeFilter argument to only regenerate that single route. The result of this is that - instead of the plugin only updating that entry in the sitemap, it re-creates the sitemap with just that single route inside.
So the request is, can the sitemap actually be based on scully.routes.json? This file stays in-tact, also after delta generation of Scully files.
Hi, after updating Scully, I noticed that your plugins to not work anymore. Below I attached some stacktrace. I assume it is caused by scully moving to a typescript-based config and it seems like the file https://github.com/scullyio/scully/tree/master/scully/utils is not there anymore...
Workaround
Downgrade to "@scullyio/scully": "0.0.90"
and use a JS-based config.
Environment:
"@scullyio/ng-lib": "0.0.22",
"@scullyio/scully": "0.0.92",
"@gammastream/scully-plugin-http404": "0.0.1",
"@gammastream/scully-plugin-sitemap": "0.0.5",
Error Log
> scully --removeStaticDist --nw --showGuessError --scan
/Users/enzovolkmann/Projekte/my-secret-project/packages/webpage /Users/enzovolkmann/Projekte/my-secret-project/packages/webpage
---------
We encountered an error executing the config file. "/Users/enzovolkmann/Projekte/my-secret-project/packages/webpage/scully.my-secret-project-webpage.config.ts"
Check the error below, and try again later
---------
Error: Cannot find module '@scullyio/scully/utils/config'
Require stack:
- /Users/enzovolkmann/Projekte/my-secret-project/packages/webpage/node_modules/@gammastream/scully-plugin-sitemap/bundles/gammastream-scully-plugin-sitemap.umd.js
- /Users/enzovolkmann/Projekte/my-secret-project/packages/webpage/scully.my-secret-project-webpage.config.js
- /Users/enzovolkmann/Projekte/my-secret-project/packages/webpage/node_modules/@scullyio/scully/lib/utils/compileConfig.js
- /Users/enzovolkmann/Projekte/my-secret-project/packages/webpage/node_modules/@scullyio/scully/lib/utils/config.js
- /Users/enzovolkmann/Projekte/my-secret-project/packages/webpage/node_modules/@scullyio/scully/lib/renderPlugins/launchedBrowser.js
- /Users/enzovolkmann/Projekte/my-secret-project/packages/webpage/node_modules/@scullyio/scully/lib/utils/handlers/defaultAction.js
- /Users/enzovolkmann/Projekte/my-secret-project/packages/webpage/node_modules/@scullyio/scully/lib/utils/handlers/index.js
- /Users/enzovolkmann/Projekte/my-secret-project/packages/webpage/node_modules/@scullyio/scully/lib/utils/index.js
- /Users/enzovolkmann/Projekte/my-secret-project/packages/webpage/node_modules/@scullyio/scully/lib/renderPlugins/contentRenderPlugin.js
- /Users/enzovolkmann/Projekte/my-secret-project/packages/webpage/node_modules/@scullyio/scully/lib/pluginManagement/systemPlugins.js
- /Users/enzovolkmann/Projekte/my-secret-project/packages/webpage/node_modules/@scullyio/scully/scully.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:797:15)
at Function.Module._load (internal/modules/cjs/loader.js:690:27)
at Module.require (internal/modules/cjs/loader.js:852:19)
at require (internal/modules/cjs/helpers.js:74:18)
at /Users/enzovolkmann/Projekte/my-secret-project/packages/webpage/node_modules/@gammastream/scully-plugin-sitemap/bundles/gammastream-scully-plugin-sitemap.umd.js:2:114
at Object.<anonymous> (/Users/enzovolkmann/Projekte/my-secret-project/packages/webpage/node_modules/@gammastream/scully-plugin-sitemap/bundles/gammastream-scully-plugin-sitemap.umd.js:5:2)
at Module._compile (internal/modules/cjs/loader.js:959:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:995:10)
at Module.load (internal/modules/cjs/loader.js:815:32)
at Function.Module._load (internal/modules/cjs/loader.js:727:14) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'/Users/enzovolkmann/Projekte/my-secret-project/packages/webpage/node_modules/@gammastream/scully-plugin-sitemap/bundles/gammastream-scully-plugin-sitemap.umd.js',
'/Users/enzovolkmann/Projekte/my-secret-project/packages/webpage/scully.my-secret-project-webpage.config.js',
'/Users/enzovolkmann/Projekte/my-secret-project/packages/webpage/node_modules/@scullyio/scully/lib/utils/compileConfig.js',
'/Users/enzovolkmann/Projekte/my-secret-project/packages/webpage/node_modules/@scullyio/scully/lib/utils/config.js',
'/Users/enzovolkmann/Projekte/my-secret-project/packages/webpage/node_modules/@scullyio/scully/lib/renderPlugins/launchedBrowser.js',
'/Users/enzovolkmann/Projekte/my-secret-project/packages/webpage/node_modules/@scullyio/scully/lib/utils/handlers/defaultAction.js',
'/Users/enzovolkmann/Projekte/my-secret-project/packages/webpage/node_modules/@scullyio/scully/lib/utils/handlers/index.js',
'/Users/enzovolkmann/Projekte/my-secret-project/packages/webpage/node_modules/@scullyio/scully/lib/utils/index.js',
'/Users/enzovolkmann/Projekte/my-secret-project/packages/webpage/node_modules/@scullyio/scully/lib/renderPlugins/contentRenderPlugin.js',
'/Users/enzovolkmann/Projekte/my-secret-project/packages/webpage/node_modules/@scullyio/scully/lib/pluginManagement/systemPlugins.js',
'/Users/enzovolkmann/Projekte/my-secret-project/packages/webpage/node_modules/@scullyio/scully/scully.js'
]
}
Hi,
i am new to scully.io and tried your plugin. But if i define my sitemapOptions and use an urlPrefix
const sitemapOptions = {
urlPrefix: 'http://localhost'
}
then the url in the sitemap.xml is rendered like this:
<url>
<loc>http:\localhost\foo\bar</loc>
<changefreq>monthly</changefreq>
<lastmod>2020-03-02T21:30:17.232Z</lastmod>
<priority>0.5</priority>
</url>
I think it might be better to use url-join instead of path.join in order to concatenate the url/loc.
Kind regards
Currently, the lastmod date for sitemap entries is updated to the last time Scully is run. It would be better if somehow the date could come from the actual lastmod date for the route.
When page-not-found component 404.html is added by this plugin, then at the same time, Did this plugin set status-code 404 in headers too when 404.html is loading ? or How can we also set status-code 404 in headers when 404.html page is loading in angular router without angular-ssr ?
First of all, thanks for making this plugin!
I have tried to install it in a project with scully using version the following versions:
"@scullyio/init": "^2.0.5",
"@scullyio/ng-lib":"^2.0.0",
"@scullyio/scully": "^2.0.0",
"@scullyio/scully/scully-plugin-puppeteer":"^2.0.0",
When installing it tells me that it is only compatible with "@scullyio/init":"^1.0.0". But using the -legacy-peer-deps option. It works correctly.
I get the following error when I install your lib. It only recently started.
Error: Cannot find module 'fast-xml-parser'
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.