mirror of
https://gitlab.com/soapbox-pub/ditto.git
synced 2025-12-06 11:29:46 +00:00
ignore OG metadata errors
This commit is contained in:
parent
2ad81d3fbf
commit
85b54e81be
1 changed files with 7 additions and 3 deletions
|
|
@ -54,11 +54,15 @@ export const frontendController: AppMiddleware = async (c, next) => {
|
||||||
const content = await Deno.readTextFile(new URL('../../public/index.html', import.meta.url));
|
const content = await Deno.readTextFile(new URL('../../public/index.html', import.meta.url));
|
||||||
if (content.includes(META_PLACEHOLDER)) {
|
if (content.includes(META_PLACEHOLDER)) {
|
||||||
const params = getPathParams(c.req.path);
|
const params = getPathParams(c.req.path);
|
||||||
|
|
||||||
if (params) {
|
if (params) {
|
||||||
|
try {
|
||||||
const meta = metadataView(await buildTemplateOpts(params, Conf.local(c.req.path)));
|
const meta = metadataView(await buildTemplateOpts(params, Conf.local(c.req.path)));
|
||||||
return c.html(content.replace(META_PLACEHOLDER, meta));
|
return c.html(content.replace(META_PLACEHOLDER, meta));
|
||||||
}
|
}
|
||||||
|
catch {
|
||||||
|
return c.html(content);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return c.html(content);
|
return c.html(content);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue