fix: missing open tags in production
This commit is contained in:
@@ -26,6 +26,8 @@ export const App = ({ url }: { url?: string }) => {
|
||||
// during server side rendering don't prepend the BASE_URL
|
||||
const pbu = useContext(ServerContext) ? (s: string) => s : prependBaseUrl
|
||||
|
||||
console.log(url)
|
||||
|
||||
return (
|
||||
<Router url={url}>
|
||||
<HomePage
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user