|
|
|
@ -97,7 +97,23 @@ async function createProductionRouter() {
|
|
|
|
|
|
|
|
|
|
const { html, metadata } = render(req.originalUrl)
|
|
|
|
|
|
|
|
|
|
res.send(transformedTemplate.replace('<!-- SSR OUTLET -->', html))
|
|
|
|
|
process.stdout.write('[Metadata] ')
|
|
|
|
|
console.dir(metadata)
|
|
|
|
|
|
|
|
|
|
const fullUrl = `${req.protocol}://${req.get('host')}${req.originalUrl}`
|
|
|
|
|
const metaTagsHtml =
|
|
|
|
|
'' +
|
|
|
|
|
(metadata.title ? `<meta property="og:title" content="${metadata.title}" />\n` : '') +
|
|
|
|
|
(metadata.description
|
|
|
|
|
? `<meta property="og:description" content="${metadata.description}" />\n`
|
|
|
|
|
: '') +
|
|
|
|
|
`<meta property="og:url" content="${fullUrl}" />\n`
|
|
|
|
|
|
|
|
|
|
res.send(
|
|
|
|
|
transformedTemplate
|
|
|
|
|
.replace('<!-- INJECT META TAGS -->', metaTagsHtml)
|
|
|
|
|
.replace('<!-- SSR OUTLET -->', html)
|
|
|
|
|
)
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
return r
|
|
|
|
|