From c768fab47d999a7175278732aa0a22d6c4feb0a3 Mon Sep 17 00:00:00 2001 From: Paul Kaplan Date: Mon, 17 Dec 2018 14:55:27 -0500 Subject: [PATCH] Add flag for dynamic meta tags in the template --- src/routes.json | 3 ++- src/template.ejs | 54 +++++++++++++++++++++++++---------------------- webpack.config.js | 3 ++- 3 files changed, 33 insertions(+), 27 deletions(-) diff --git a/src/routes.json b/src/routes.json index d2efe59a2..bcb4bd28a 100644 --- a/src/routes.json +++ b/src/routes.json @@ -167,7 +167,8 @@ "pattern": "^/projects(/editor|(/\\d+(/editor|/fullscreen|/embed)?)?)?/?(\\?.*)?$", "routeAlias": "/projects/?$", "view": "preview/preview", - "title": "Scratch Project" + "title": "Scratch Project", + "dynamicMetaTags": true }, { "name": "3faq", diff --git a/src/template.ejs b/src/template.ejs index 0a0fcdcd6..418cf490f 100644 --- a/src/template.ejs +++ b/src/template.ejs @@ -8,23 +8,25 @@ - Scratch - <%= htmlWebpackPlugin.options.title %> - - - - + <% if (!htmlWebpackPlugin.options.dynamicMetaTags) { %> + Scratch - <%= htmlWebpackPlugin.options.title %> - - - - - - - - + + + + + + + + + + + + + <% } %> @@ -60,19 +62,21 @@ - + + <% } %> diff --git a/webpack.config.js b/webpack.config.js index 79576094c..b278d4d18 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -132,7 +132,8 @@ module.exports = { return new HtmlWebpackPlugin(defaults({}, { title: route.title, filename: route.name + '.html', - route: route + route: route, + dynamicMetaTags: route.dynamicMetaTags }, templateConfig)); }) ).concat([