mirror of
https://github.com/SrIzan10/spongebin.git
synced 2026-05-01 11:05:09 +00:00
feat: add test codeblock preview
This commit is contained in:
@@ -39,10 +39,17 @@ export async function generateMetadata({ params }: Props) {
|
||||
};
|
||||
|
||||
const numLines = paste.content.split("\n").length;
|
||||
const codeblockPreview = paste.content
|
||||
.split("\n")
|
||||
.slice(0, 3)
|
||||
.join("\n")
|
||||
.replace(/`/g, "\\`")
|
||||
.replace(/^\s*```(\w+)?/, "```" + paste.language)
|
||||
.replace(/^\s*```/, "```");
|
||||
|
||||
return {
|
||||
title: `spongebin • ${paste.id}`,
|
||||
description: `a paste containing ${numLines} lines of ${paste.language}`,
|
||||
description: `a paste containing ${numLines} lines of ${paste.language}\ncode:\n${codeblockPreview}`,
|
||||
openGraph: { images: "/sponge.png" },
|
||||
twitter: { card: "summary" },
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user