This commit is contained in:
taskylizard 2023-11-06 21:46:23 +05:30
parent cc91903e2b
commit 580deea601
No known key found for this signature in database
GPG Key ID: 5CABA3D642DDC497
2 changed files with 5 additions and 20 deletions

View File

@ -1,17 +1,16 @@
<script setup lang="ts"> <script setup lang="ts">
defineProps<{ title: string; description?: string; dir?: string }>(); defineProps<{ title: string; description?: string }>();
</script> </script>
<template> <template>
<div tw="w-full h-full bg-black flex flex-col" style="background-image: url(https://files.catbox.moe/1f84dy.png)"> <div
tw="w-full h-full bg-black flex flex-col"
style="background-image: url(https://files.catbox.moe/1f84dy.png)">
<div tw="p-10 w-full min-h-0 grow flex flex-col items-center justify-between"> <div tw="p-10 w-full min-h-0 grow flex flex-col items-center justify-between">
<div tw="w-full flex justify-between items-center text-5xl font-medium"> <div tw="w-full flex justify-between items-center text-5xl font-medium">
<div tw="flex items-center"> <div tw="flex items-center">
<div tw="text-zinc-100 ml-2 mt-1 font-semibold">freemediaheckyeah</div> <div tw="text-zinc-100 ml-2 mt-1 font-semibold">freemediaheckyeah</div>
</div> </div>
<div tw="flex items-center text-zinc-300">
<div tw="text-4xl font-semibold mr-2" v-html="dir" />
</div>
</div> </div>
<div tw="w-full pr-56 flex flex-col items-start justify-end"> <div tw="w-full pr-56 flex flex-col items-start justify-end">
<div tw="text-6xl font-bold text-stone-200" v-html="title" /> <div tw="text-6xl font-bold text-stone-200" v-html="title" />

View File

@ -40,9 +40,7 @@ export async function generateImages(config: SiteConfig) {
}, },
]; ];
const filteredPages = pages.filter((p) => p.frontmatter.image === undefined); for (const page of pages) {
for (const page of filteredPages) {
await generateImage({ await generateImage({
page, page,
template, template,
@ -59,17 +57,6 @@ interface GenerateImagesOptions {
fonts: SatoriOptions["fonts"]; fonts: SatoriOptions["fonts"];
} }
function getDir(url: string) {
if (url.startsWith("/glossary/")) {
return "Glossary";
} else if (url.startsWith("/guides/")) {
return "Guide";
}
// Means we are at root.
return undefined;
}
async function generateImage({ page, template, outDir, fonts }: GenerateImagesOptions) { async function generateImage({ page, template, outDir, fonts }: GenerateImagesOptions) {
const { frontmatter, url } = page; const { frontmatter, url } = page;
@ -86,7 +73,6 @@ async function generateImage({ page, template, outDir, fonts }: GenerateImagesOp
frontmatter.layout === "home" frontmatter.layout === "home"
? frontmatter.hero.tagline ?? frontmatter.description ? frontmatter.hero.tagline ?? frontmatter.description
: frontmatter.description, : frontmatter.description,
dir: getDir(url),
}, },
}; };