Skip to content
Merged

cleanup #1618

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 1 addition & 18 deletions apps/web/content-collections.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import { defineCollection, defineConfig } from "@content-collections/core";
import { compileMDX } from "@content-collections/mdx";
import { existsSync } from "fs";
import { join } from "path";
import rehypeAutolinkHeadings from "rehype-autolink-headings";
import rehypeSlug from "rehype-slug";
import remarkGfm from "remark-gfm";
Expand Down Expand Up @@ -39,7 +37,7 @@ const articles = defineCollection({
author: z.string(),
created: z.string(),
updated: z.string().optional(),
coverImage: z.string().optional(),
coverImage: z.string(),
featured: z.boolean().optional(),
}),
transform: async (document, context) => {
Expand All @@ -63,27 +61,12 @@ const articles = defineCollection({

const slug = document._meta.path.replace(/\.mdx$/, "");

let coverImage = document.coverImage;
if (!coverImage) {
const formats = ["webp", "png", "jpg", "jpeg"];
const publicDir = join(process.cwd(), "public");

for (const format of formats) {
const imagePath = join(publicDir, "blog", slug, `cover.${format}`);
if (existsSync(imagePath)) {
coverImage = `/blog/${slug}/cover.${format}`;
break;
}
}
}

const author = document.author || "Hyprnote Team";

return {
...document,
mdx,
slug,
coverImage,
author,
toc,
};
Expand Down
8 changes: 4 additions & 4 deletions apps/web/content/docs/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,16 @@ Cheers,
Team Hyprnote

<img
className="block dark:hidden max-w-32"
src="/hyprnote/signature-dark.svg"
className="block dark:hidden max-w-32 border-none!"
src="https://ijoptyyjrfqwaqhyxkxj.supabase.co/storage/v1/object/public/public_images/hyprnote/signature-dark.svg"
alt="Hyprnote Signature"
title="Hyprnote Signature"
style={{ width: "22%" }}
/>

<img
className="hidden dark:block max-w-32"
src="/hyprnote/signature-light.svg"
className="hidden dark:block max-w-32 border-none!"
src="https://ijoptyyjrfqwaqhyxkxj.supabase.co/storage/v1/object/public/public_images/hyprnote/signature-light.svg"
alt="Hyprnote Signature"
title="Hyprnote Signature"
style={{ width: "22%" }}
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/routes/_view/blog/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ function ArticleListItem({ article }: { article: Article }) {
</span>
<span className="text-sm text-neutral-500">by {article.author}</span>
<div className="h-px flex-1 bg-neutral-200" />
<time dateTime={displayDate} className="text-sm text-neutral-500 flex-shrink-0">
<time dateTime={displayDate} className="text-sm text-neutral-500 shrink-0">
{new Date(displayDate).toLocaleDateString("en-US", {
month: "short",
day: "numeric",
Expand Down
Loading