Skip to content
This repository has been archived by the owner on Jul 31, 2019. It is now read-only.

[865709] Generating open graph meta tags. #36

Closed
wants to merge 6 commits into from

Conversation

ScottDowne
Copy link
Contributor

No description provided.

]
}),
finalized = sanitized.replace(/<body([^>]*)>/, "<body$1>" + remixThis)
.replace(/<head([^>]*)>/, "<head$1>" + metaTags);
Copy link
Contributor

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({
Copy link
Contributor

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?

@@ -129,6 +152,12 @@ exports.finalizeProject = function(nunjucksEnv, env) {
cssUrl: hostname + "/stylesheets",
mixUrl: hostname + "/remix/" + req.publishId + "/edit"
}),
metadata = req.body.metadata || {},
Copy link
Contributor

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 || {},
Copy link
Contributor

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?

@ScottDowne ScottDowne closed this Apr 30, 2013
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
2 participants