[865709] Generating open graph meta tags. #36
Conversation
] | ||
}), | ||
finalized = sanitized.replace(/<body([^>]*)>/, "<body$1>" + remixThis) | ||
.replace(/<head([^>]*)>/, "<head$1>" + metaTags); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this needs to come after the <meta charset="..."> tag, because encourtering the charset tag will cause a browser to reparse everything it's seen up to then. We could add this before </head, just like the GA scripts?
@@ -129,6 +129,44 @@ exports.finalizeProject = function(nunjucksEnv, env) { | |||
cssUrl: hostname + "/stylesheets", | |||
mixUrl: hostname + "/remix/" + req.publishId + "/edit" | |||
}), | |||
metadata = req.body.metadata || {}, | |||
metaTagTemplate = nunjucksEnv.getTemplate("ogMetaTags.html"), | |||
metaTags = metaTagTemplate.render({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is a lot of code for inside "another" middleware function, can we make generating the metaTags its own function somehow?
… time sent to og tag.
@@ -129,6 +152,12 @@ exports.finalizeProject = function(nunjucksEnv, env) { | |||
cssUrl: hostname + "/stylesheets", | |||
mixUrl: hostname + "/remix/" + req.publishId + "/edit" | |||
}), | |||
metadata = req.body.metadata || {}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if we're doing metaTags, then we probably want to use metaData, too, just to be case-consistent.
@@ -129,6 +152,12 @@ exports.finalizeProject = function(nunjucksEnv, env) { | |||
cssUrl: hostname + "/stylesheets", | |||
mixUrl: hostname + "/remix/" + req.publishId + "/edit" | |||
}), | |||
metaData = req.body.metaData || {}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
last nit: this data gets allocated but not used, with the actual injection happening after GA injection. Is that necessary? Can we not simply do finalized = sanitized.replace(/<body([^>]*)>/, "<body$1>" + remixThis); [newline] finalized = finalized.replace("</head", metaTagsRender + "</head");
and then do google injection after that?
No description provided.