From ac9ab52d63fd75e047d6e1a5a063909d85b0fbaa Mon Sep 17 00:00:00 2001 From: Daniel Kluge Date: Sun, 22 Mar 2026 21:54:49 +0100 Subject: [PATCH] Use repository link for projects --- src/content.config.ts | 1 + src/pages/portfolio/[...slug].astro | 43 +++++++++++++++++++++++++---- src/pages/portfolio/index.astro | 39 ++++++++++++++++++++++---- 3 files changed, 73 insertions(+), 10 deletions(-) diff --git a/src/content.config.ts b/src/content.config.ts index 3bbb024..f6928ee 100644 --- a/src/content.config.ts +++ b/src/content.config.ts @@ -17,6 +17,7 @@ const portfolioCollection = defineCollection({ summary: z.string(), tags: z.array(z.string()).optional(), pubDate: z.date(), + repository: z.url().regex(/git/).optional(), }), }); diff --git a/src/pages/portfolio/[...slug].astro b/src/pages/portfolio/[...slug].astro index 757d5bb..b33db26 100644 --- a/src/pages/portfolio/[...slug].astro +++ b/src/pages/portfolio/[...slug].astro @@ -1,5 +1,6 @@ --- import { getCollection, render } from 'astro:content'; +import { Icon } from "astro-icon/components"; import BaseLayout from '../../layouts/BaseLayout.astro'; import "katex/dist/katex.min.css"; import "rehype-callouts/theme/obsidian" @@ -18,11 +19,23 @@ const { Content } = await render(entry);

{entry.data.title}

{entry.data.summary}

- {entry.data.tags && ( -
- {entry.data.tags.map(tech => {tech})} -
- )} + {(entry.data.tags || entry.data.repository) && + (
+
+ {entry.data.tags && ( +
+ {entry.data.tags?.map(tech => {tech})} +
+ )} +
+
+ { entry.data.repository && ( + + + + )} +
+
)}
@@ -39,6 +52,7 @@ const { Content } = await render(entry); gap: 0.5rem; margin-top: 1rem; flex-wrap: wrap; + align-items: center; } .tag { font-size: 0.8rem; @@ -49,4 +63,23 @@ const { Content } = await render(entry); .content { line-height: 1.8; } + .additional-meta { + display: flex; + flex-direction: row; + flex-wrap: nowrap; + gap: 0.5rem; + width: 100%; + justify-content: space-between; + margin-top: 1rem; + align-items: center; + } + .meta-repository { + flex-shrink: 1; + font-size: 1.2rem; + color: rgb(var(--accent-base)); + } + .meta-repository a { + display: flex; + align-items: center; + } diff --git a/src/pages/portfolio/index.astro b/src/pages/portfolio/index.astro index 095ab71..f2c717e 100644 --- a/src/pages/portfolio/index.astro +++ b/src/pages/portfolio/index.astro @@ -1,5 +1,6 @@ --- import { getCollection } from 'astro:content'; +import { Icon } from "astro-icon/components"; import BaseLayout from '../../layouts/BaseLayout.astro'; const projects = await getCollection('portfolio'); @@ -16,11 +17,21 @@ projects.sort((a, b) => b.data.pubDate.getTime() - a.data.pubDate.getTime());

{project.data.title}

{project.data.summary}

- {project.data.tags && ( -
@@ -40,11 +51,22 @@ projects.sort((a, b) => b.data.pubDate.getTime() - a.data.pubDate.getTime()); .link-card h2 { margin-top: 0; } + .additional-meta { + display: flex; + flex-direction: row; + flex-wrap: nowrap; + gap: 0.5rem; + width: 100%; + justify-content: space-between; + margin-top: 1rem; + align-items: center; + } .tags { display: flex; gap: 0.5rem; - margin-top: 1rem; flex-wrap: wrap; + flex-grow: 1; + align-items: center; } .tag { font-size: 0.8rem; @@ -52,4 +74,11 @@ projects.sort((a, b) => b.data.pubDate.getTime() - a.data.pubDate.getTime()); padding: 0.25rem 0.5rem; border-radius: 0.25rem; } + .meta-repository { + flex-shrink: 1; + font-size: 1.2rem; + display: flex; + align-items: center; + color: rgb(var(--accent-base)); + }