Restored to 'eede1dca5c3b2cb640881195fc428ec171b5dce3'

Replit-Restored-To: eede1dca5c
This commit is contained in:
sebastjanartic
2026-03-05 12:18:32 +00:00
parent 9e0c1719db
commit d6b620233b
43 changed files with 675 additions and 1716 deletions
+1 -10
View File
@@ -13,15 +13,6 @@ function escapeHtml(str: string): string {
return str.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
}
function ogImageUrl(coverImage: string, baseUrl: string): string {
if (!coverImage) return "";
let imgPath = coverImage;
if (imgPath.endsWith(".webp")) {
imgPath = imgPath.replace(/\.webp$/, ".jpg");
}
return imgPath.startsWith("http") ? imgPath : `${baseUrl}${imgPath}`;
}
export async function setupVite(server: Server, app: Express) {
const serverOptions = {
middlewareMode: true,
@@ -72,7 +63,7 @@ export async function setupVite(server: Server, app: Express) {
const protocol = req.get("x-forwarded-proto") || "https";
const baseUrl = `${protocol}://${host}`;
const articleUrl = `${baseUrl}/article/${article.slug}`;
const imageUrl = ogImageUrl(article.coverImage || "", baseUrl);
const imageUrl = article.coverImage ? (article.coverImage.startsWith("http") ? article.coverImage : `${baseUrl}${article.coverImage}`) : "";
const ogTags = [
`<meta property="og:title" content="${escapeHtml(article.title)}" />`,