Add links to content pages
Some checks failed
Deploy Astro / Build and Deploy (push) Failing after 44s
Some checks failed
Deploy Astro / Build and Deploy (push) Failing after 44s
This commit is contained in:
parent
38492baf96
commit
2c88ae7815
@ -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
|
||||
|
@ -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") ?
|
||||
<slot name="main-nav" /> :
|
||||
null}
|
||||
|
||||
{ moreLinks && moreLinks.length !== 0 ?
|
||||
<div class="more">
|
||||
{ moreLinks.map(l => <a href={l.href} referrerpolicy="no-referrer" class="nostyle" style={{ display: "inline-block", width: "2em" }}><Icon name={l.icon} /></a>) }
|
||||
</div>
|
||||
: null}
|
||||
<slot />
|
||||
{ published || srcPath ? <>
|
||||
<hr />
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
</style>
|
@ -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",
|
||||
});
|
||||
}
|
||||
---
|
||||
|
||||
<MarkdownLayout title={diaryMain.data.title} srcPath={`diaryMainPages/${diaryMain.id}`}>
|
||||
<MarkdownLayout title={diaryMain.data.title} srcPath={`diaryMainPages/${diaryMain.id}`} moreLinks={moreLinks}>
|
||||
<Content />
|
||||
|
||||
<h2>Pages</h2>
|
||||
|
@ -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",
|
||||
});
|
||||
}
|
||||
|
||||
---
|
||||
|
||||
<MarkdownLayout title={entry.data.title} srcPath={`projects/${entry.id}`} published={entry.data.published}>
|
||||
<MarkdownLayout title={entry.data.title} srcPath={`projects/${entry.id}`} published={entry.data.published} moreLinks={moreLinks}>
|
||||
<Content />
|
||||
</MarkdownLayout>
|
||||
|
Loading…
Reference in New Issue
Block a user