fix: fix the codeblock preview hopefully

This commit is contained in:
DuroCodes
2025-05-27 14:34:25 -04:00
parent 843ea6d2e3
commit e974ae7882

View File

@@ -39,13 +39,13 @@ export async function generateMetadata({ params }: Props) {
}; };
const numLines = paste.content.split("\n").length; const numLines = paste.content.split("\n").length;
const codeblockPreview = paste.content const codeblockContent = paste.content
.split("\n") .split("\n")
.slice(0, 3) .slice(0, 3)
.join("\n") .join("\n")
.replace(/`/g, "\\`") .replace(/`/g, "\\`");
.replace(/^\s*```(\w+)?/, "```" + paste.language)
.replace(/^\s*```/, "```"); const codeblockPreview = `\`\`\`${paste.language}\n${codeblockContent}\n\`\`\``;
return { return {
title: `spongebin • ${paste.id}`, title: `spongebin • ${paste.id}`,