feat(gist): gist page
This commit is contained in:
parent
7b09edb899
commit
fdb2fa808a
4 changed files with 54 additions and 19 deletions
24
src/pages/gist.astro
Normal file
24
src/pages/gist.astro
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
---
|
||||
import BaseLayout from "../layouts/BaseLayout.astro";
|
||||
import { getCollection } from "astro:content";
|
||||
|
||||
const title = "Gists";
|
||||
const gists = await getCollection("gists");
|
||||
gists.sort((a, b) => a.slug.localeCompare(b.slug));
|
||||
---
|
||||
|
||||
<BaseLayout title={title}>
|
||||
<slot name="head" slot="head">
|
||||
<link rel="stylesheet" href="/styles/index.css" />
|
||||
</slot>
|
||||
|
||||
<div class="content">
|
||||
<ul class="topics">
|
||||
{gists.map((gist) => (
|
||||
<li class="topic">
|
||||
<a href={`/gist/${gist.slug}.html`}>{gist.data.title || gist.slug}</a>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</div>
|
||||
</BaseLayout>
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
import { getEntry } from "astro:content";
|
||||
import PostLayout from "../../layouts/PostLayout.astro";
|
||||
import GitLayout from "../../layouts/GitLayout.astro";
|
||||
|
||||
export async function getStaticPaths() {
|
||||
const res = await fetch("https://git.barrettruth.com/api/repositories");
|
||||
|
|
@ -28,12 +28,11 @@ try {
|
|||
} catch {}
|
||||
---
|
||||
|
||||
<PostLayout frontmatter={entry.data} post={entry}>
|
||||
<GitLayout frontmatter={entry.data} post={entry}>
|
||||
{cloneCommand && (
|
||||
<div class="clone-banner">
|
||||
<pre><code class="language-bash">{cloneCommand}</code></pre>
|
||||
<div class="clone-line">
|
||||
<code>> {cloneCommand}</code>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<Content />
|
||||
</PostLayout>
|
||||
</GitLayout>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue