Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- new PrerenderSPAPlugin({
- // Required - The path to the webpack-outputted app to prerender.
- staticDir: path.join(__dirname, '../web'),
- // Required - Routes to render.
- routes: ['/', '/blog', '/currency'],
- postProcess(context) {
- context.path = context.originalPath;
- const titles = {
- '/': 'Coldsewoo',
- '/blog': 'Coldsewoo - a blog',
- '/currency': 'Coldsewoo - currency',
- };
- const desc = {
- '/': 'Home page',
- '/blog': 'blog',
- '/currency': 'Currency exchange information',
- };
- context.html = context.html.replace(
- /<title>[^<]*<\/title>/i,
- `<meta name="description" content="${desc[context.route]}"><meta property="og:title" content="${titles[context.route]}"><meta property="og:type" content="website"><meta property="og:site_name" content="Coldsewoo web"><meta property="og:description" content="${desc[context.route]}"><meta property="fb:admins" content="coldsewoo"><meta name="twitter:card" content="app"><meta name="twitter:site" content="@corysmc"><meta name="twitter:title" content="${titles[context.route]}"><meta name="twitter:description" content="${desc[context.route]}"><title>${titles[context.route]}</title>`
- )
- return context;
- },
- }),
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement