Skip to content

Commit d1d7d22

Browse files
committed
feat: Add link to GitHub repo
1 parent fd24abc commit d1d7d22

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

readme.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ title: Tile of the snippet
1616
description: description of the snippet
1717
pubDate: (Dare) Feb 20, 2022
1818
contributedBy: "@TwitterHandle"
19+
repoUrl: "@GithubRepo"
1920
---
2021

2122
import BlogImage from "@components/BlogImage.astro";

src/layouts/BlogLayout.astro

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ export interface Props {
1010
description?: string;
1111
image?: string;
1212
ImageAlt?: string;
13+
githubRepoUrl?: string;
1314
}
1415
1516
const thisDate = new Date(pubDate).toLocaleDateString("en", {
@@ -93,9 +94,10 @@ const canonicalURL = new URL(Astro.url).href;
9394
<time datetime={frontmatter.pubDate} class="mb-3 sm:mb-0">
9495
{thisDate}
9596
</time>
96-
<time datetime={frontmatter.contributedBy} class="mb-3 sm:mb-0">
97+
<span class="mb-3 sm:mb-0">
9798
{frontmatter.contributedBy}
98-
</time>
99+
</span>
100+
{frontmatter.repoUrl && <a href={frontmatter.repoUrl} target="_blank" class="dark:text-blue-400 text-blue-600 mb-3 sm:mb-0">Open Repo</a>}
99101
</nav>
100102
</header>
101103
<article>

0 commit comments

Comments
 (0)