mirror of
https://gitlab.com/soapbox-pub/ditto.git
synced 2025-12-06 11:29:46 +00:00
Render OG data on every page
This commit is contained in:
parent
5f1b87c3b6
commit
2f2fda2ac3
1 changed files with 7 additions and 9 deletions
|
|
@ -28,15 +28,13 @@ export const frontendController: AppMiddleware = async (c, next) => {
|
||||||
|
|
||||||
if (content.includes(META_PLACEHOLDER)) {
|
if (content.includes(META_PLACEHOLDER)) {
|
||||||
const params = getPathParams(c.req.path);
|
const params = getPathParams(c.req.path);
|
||||||
if (params) {
|
try {
|
||||||
try {
|
const entities = await getEntities(params ?? {});
|
||||||
const entities = await getEntities(params);
|
const meta = renderMetadata(c.req.url, entities);
|
||||||
const meta = renderMetadata(c.req.url, entities);
|
return c.html(content.replace(META_PLACEHOLDER, meta));
|
||||||
return c.html(content.replace(META_PLACEHOLDER, meta));
|
} catch (e) {
|
||||||
} catch (e) {
|
console.log(`Error building meta tags: ${e}`);
|
||||||
console.log(`Error building meta tags: ${e}`);
|
return c.html(content);
|
||||||
return c.html(content);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return c.html(content);
|
return c.html(content);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue