diff --git a/server.js b/server.js index 41da1ffa..bb42a74c 100644 --- a/server.js +++ b/server.js @@ -240,6 +240,9 @@ app.use(async function reactMiddleware(ctx) { } try { + // we always render Helmet's metadata as tags like + Helmet.canUseDOM = false; + const html = renderToString( @@ -251,9 +254,7 @@ app.use(async function reactMiddleware(ctx) { ctx.status = fetchHandler.status; } - // we always render Helmet's metadata as tags like - Helmet.canUseDOM = false; - const metadata = Helmet.rewind(); + const metadata = Helmet.renderStatic(); // Actual status code is returned with fetchData() // ctx.status = 200;