diff --git a/src/content/diaryMainPages/rust.mdx b/src/content/diaryMainPages/rust.mdx index 4be5a8d..7d1aa37 100644 --- a/src/content/diaryMainPages/rust.mdx +++ b/src/content/diaryMainPages/rust.mdx @@ -3,6 +3,7 @@ title: Learning Rust lastUpdated: 2022-06-14T12:21:00.755Z description: "I documented my progress to learn the Rust programming language. It follows the Rust book with my own annotations. Everything is in German as these notes are mostly meant for me." descriptionShort: "Me learning Rust (German)." +relatedWebsite: https://doc.rust-lang.org/book/ --- # Learning Rust diff --git a/src/layouts/MarkdownLayout.astro b/src/layouts/MarkdownLayout.astro index 8f2dea7..7567e88 100644 --- a/src/layouts/MarkdownLayout.astro +++ b/src/layouts/MarkdownLayout.astro @@ -1,13 +1,18 @@ --- import Layout from "./Layout.astro"; +import { Icon } from "astro-icon"; interface Props { title: string; published?: Date; srcPath?: string; + moreLinks?: { + icon: string; + href: string; + }[]; } -const { title, srcPath, published } = Astro.props; +const { title, srcPath, published, moreLinks } = Astro.props; const gitUrl = `https://git.c0ntroller.de/c0ntroller/frontpage/src/branch/astro/src/content/${srcPath}` --- @@ -15,6 +20,12 @@ const gitUrl = `https://git.c0ntroller.de/c0ntroller/frontpage/src/branch/astro/ {Astro.slots.has("main-nav") ? : null} + + { moreLinks && moreLinks.length !== 0 ? +
+ { moreLinks.map(l => ) } +
+ : null} { published || srcPath ? <>
@@ -155,4 +166,20 @@ const gitUrl = `https://git.c0ntroller.de/c0ntroller/frontpage/src/branch/astro/ } } } + + .more { + float: right; + + @media screen and (max-width: 890px) { + & { + float: none; + display: block; + width: max-content; + margin-left: auto; + margin-right: auto; + } + } + } + + \ No newline at end of file diff --git a/src/pages/blog/[diary].astro b/src/pages/blog/[diary].astro index 57f31a2..c137f16 100644 --- a/src/pages/blog/[diary].astro +++ b/src/pages/blog/[diary].astro @@ -22,9 +22,23 @@ const collectionBasePath = `/blog/${diary}`; const diaryPages = (await getCollection(diary)).sort((a, b) => a.data.sorting - b.data.sorting); const { Content } = await diaryMain.render(); + +const moreLinks = []; +if (diaryMain.data.relatedWebsite) { + moreLinks.push({ + href: diaryMain.data.relatedWebsite, + icon: "mdi:web", + }); +} +if (diaryMain.data.repository) { + moreLinks.push({ + href: diaryMain.data.repository, + icon: "bi:git", + }); +} --- - +

Pages

diff --git a/src/pages/blog/[entry].astro b/src/pages/blog/[entry].astro index 72453be..df32d0c 100644 --- a/src/pages/blog/[entry].astro +++ b/src/pages/blog/[entry].astro @@ -18,8 +18,23 @@ export async function getStaticPaths() { const { entry } = Astro.props; const { Content } = await entry.render(); + +const moreLinks = []; +if (entry.data.relatedWebsite) { + moreLinks.push({ + href: entry.data.relatedWebsite, + icon: "mdi:web", + }); +} +if (entry.data.repository) { + moreLinks.push({ + href: entry.data.repository, + icon: "bi:git", + }); +} + --- - +