From 2f2fda2ac3d0ba6677e044b2c54b7b602b27d833 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Wed, 7 Aug 2024 21:06:51 -0500 Subject: [PATCH] Render OG data on every page --- src/controllers/frontend.ts | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/controllers/frontend.ts b/src/controllers/frontend.ts index 9f52a27e..8a598d08 100644 --- a/src/controllers/frontend.ts +++ b/src/controllers/frontend.ts @@ -28,15 +28,13 @@ export const frontendController: AppMiddleware = async (c, next) => { if (content.includes(META_PLACEHOLDER)) { const params = getPathParams(c.req.path); - if (params) { - try { - const entities = await getEntities(params); - const meta = renderMetadata(c.req.url, entities); - return c.html(content.replace(META_PLACEHOLDER, meta)); - } catch (e) { - console.log(`Error building meta tags: ${e}`); - return c.html(content); - } + try { + const entities = await getEntities(params ?? {}); + const meta = renderMetadata(c.req.url, entities); + return c.html(content.replace(META_PLACEHOLDER, meta)); + } catch (e) { + console.log(`Error building meta tags: ${e}`); + return c.html(content); } } return c.html(content);