Render OG data on every page

This commit is contained in:
Alex Gleason 2024-08-07 21:06:51 -05:00
parent 5f1b87c3b6
commit 2f2fda2ac3
No known key found for this signature in database
GPG key ID: 7211D1F99744FBB7

View file

@ -28,9 +28,8 @@ 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 entities = await getEntities(params ?? {});
const meta = renderMetadata(c.req.url, entities);
return c.html(content.replace(META_PLACEHOLDER, meta));
} catch (e) {
@ -38,7 +37,6 @@ export const frontendController: AppMiddleware = async (c, next) => {
return c.html(content);
}
}
}
return c.html(content);
} catch (e) {
console.log(e);