Merge pull request #2497 from paulkaplan/dynamic-meta-tag-template

Add flag for dynamic meta tags in the template
This commit is contained in:
Paul Kaplan 2018-12-17 15:39:13 -05:00 committed by GitHub
commit e3e12deea5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 33 additions and 27 deletions

View file

@ -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",

View file

@ -8,11 +8,12 @@
<meta http-equiv="x-ua-compatible" content="ie=edge">
<meta name="viewport" content="width=<%= htmlWebpackPlugin.options.viewportWidth %>, initial-scale=1">
<title>Scratch - <%= htmlWebpackPlugin.options.title %></title>
<!-- Prevent mobile Safari from making phone numbers -->
<meta name="format-detection" content="telephone=no">
<% if (!htmlWebpackPlugin.options.dynamicMetaTags) { %>
<title>Scratch - <%= htmlWebpackPlugin.options.title %></title>
<!-- Search & Open Graph-->
<meta name="description" content="<%= htmlWebpackPlugin.options.description %>" />
<meta name="google-site-verification" content="m_3TAXDreGTFyoYnEmU9mcKB4Xtw5mw6yRkuJtXRKxM" />
@ -25,6 +26,7 @@
<meta property="og:image:type" content="<%- htmlWebpackPlugin.options.og_image_type %>" />
<meta property="og:image:width" content="<%- htmlWebpackPlugin.options.og_image_width %>" />
<meta property="og:image:height" content="<%- htmlWebpackPlugin.options.og_image_height %>" />
<% } %>
<!-- Favicon & CSS normalize -->
<link rel="shortcut icon" href="/favicon.ico" />
@ -60,6 +62,7 @@
<script src="/<%= htmlWebpackPlugin.files.chunks[htmlWebpackPlugin.options.route.name].entry %>"></script>
<!-- Translate title element -->
<% if (!htmlWebpackPlugin.options.dynamicMetaTags) { %>
<script>
var loc = window._locale || 'en';
if (typeof window._messages !== 'undefined' && loc !== 'en') {
@ -74,5 +77,6 @@
}
}
</script>
<% } %>
</body>
</html>

View file

@ -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([