refined design
Some checks failed
Next.js App CI / docker (push) Failing after 3m19s

This commit is contained in:
2025-09-14 22:49:23 +02:00
parent 78de337446
commit 0444067c2d
89 changed files with 1117 additions and 594 deletions

View File

@@ -1,4 +1,3 @@
import fs from "fs";
import path from "path";
import matter from "gray-matter";
@@ -9,13 +8,14 @@ const tagsFilePath = path.join(postsDirectory, "tags.json");
type PostData = {
id: string;
href: string;
venue: string;
date: string;
tags: string[];
image: string | null;
image: string | undefined;
title?: string;
excerpt?: string;
video?: string;
[key: string]: any;
[key: string]: string | string[] | null | undefined;
};
function getPostFilePaths(dir: string, fileList: string[] = []) {
@@ -55,12 +55,14 @@ export function getSortedPostsData(category?: string): PostData[] {
? matterResult.data.tags
: matterResult.data.tags.split(/, ?/)
: [];
const venue = matterResult.data.venue ? matterResult.data.venue: "arxive";
let image = matterResult.data.teaser || matterResult.data.image || null;
const image = matterResult.data.teaser || matterResult.data.image || null;
return {
id,
href,
venue,
date: matterResult.data.date ?? dateFromFileName,
...matterResult.data,
tags,
@@ -77,8 +79,8 @@ export function getSortedPostsData(category?: string): PostData[] {
});
}
export function getAllTags(minCount: number = 1) {
const allPosts = getSortedPostsData();
export function getAllTags(minCount: number = 1, category?: "experience" | "research") {
const allPosts = getSortedPostsData(category);
const tags: { [tag: string]: number } = {};
allPosts.forEach((post) => {