mirror of
https://gitlab.com/soapbox-pub/ditto.git
synced 2025-12-06 03:19:46 +00:00
rename OG_META_PLACEHOLDER --> META_PLACEHOLDER
This commit is contained in:
parent
2cafc2014f
commit
c0a6d48d55
1 changed files with 3 additions and 3 deletions
|
|
@ -11,7 +11,7 @@ import {
|
|||
import { AppMiddleware } from '@/app.ts';
|
||||
|
||||
/** Placeholder to find & replace with metadata. */
|
||||
const OG_META_PLACEHOLDER = '<!--server-generated-meta-->' as const;
|
||||
const META_PLACEHOLDER = '<!--server-generated-meta-->' as const;
|
||||
|
||||
/*
|
||||
* TODO: implement caching for posts (LRUCache)
|
||||
|
|
@ -110,12 +110,12 @@ const buildMetaTags = async (params: PathParams, url: string): Promise<string> =
|
|||
export const frontendController: AppMiddleware = async (c, next) => {
|
||||
try {
|
||||
const content = await Deno.readTextFile(new URL('../../public/index.html', import.meta.url));
|
||||
if (content.includes(OG_META_PLACEHOLDER)) {
|
||||
if (content.includes(META_PLACEHOLDER)) {
|
||||
const params = getPathParams(c.req.path);
|
||||
|
||||
if (params) {
|
||||
const meta = await buildMetaTags(params, Conf.local(c.req.path));
|
||||
return c.html(content.replace(OG_META_PLACEHOLDER, meta));
|
||||
return c.html(content.replace(META_PLACEHOLDER, meta));
|
||||
}
|
||||
}
|
||||
return c.html(content);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue