mirror of
https://github.com/rjNemo/orbital-orbit
synced 2026-06-06 06:56:40 +00:00
feat: add tags index page
This commit is contained in:
parent
f06ae6b055
commit
65c976ed93
3 changed files with 74 additions and 0 deletions
|
|
@ -2,4 +2,5 @@
|
||||||
<a href="/">Home</a>
|
<a href="/">Home</a>
|
||||||
<a href="/about">About</a>
|
<a href="/about">About</a>
|
||||||
<a href="/blog">Blog</a>
|
<a href="/blog">Blog</a>
|
||||||
|
<a href="/tags">Tags</a>
|
||||||
</nav>
|
</nav>
|
||||||
|
|
|
||||||
|
|
@ -8,5 +8,34 @@ const { frontmatter } = Astro.props;
|
||||||
<p><em>{frontmatter.description}</em></p>
|
<p><em>{frontmatter.description}</em></p>
|
||||||
<p>Written by: {frontmatter.author}</p>
|
<p>Written by: {frontmatter.author}</p>
|
||||||
<img src={frontmatter.image.url} alt={frontmatter.image.alt} width="500" />
|
<img src={frontmatter.image.url} alt={frontmatter.image.alt} width="500" />
|
||||||
|
<div class="tags">
|
||||||
|
{
|
||||||
|
frontmatter.tags.map((tag: any) => (
|
||||||
|
<p class="tag">
|
||||||
|
<a href={`/tags/${tag}`}>{tag}</a>
|
||||||
|
</p>
|
||||||
|
))
|
||||||
|
}
|
||||||
|
</div>
|
||||||
<slot />
|
<slot />
|
||||||
</BaseLayout>
|
</BaseLayout>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
a {
|
||||||
|
color: #00539f;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tags {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tag {
|
||||||
|
margin: 0.25em;
|
||||||
|
border: dotted 1px #a1a1a1;
|
||||||
|
border-radius: 0.5em;
|
||||||
|
padding: 0.5em 1em;
|
||||||
|
font-size: 1.15em;
|
||||||
|
background-color: #f8fcfd;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
|
||||||
44
src/pages/tags/index.astro
Normal file
44
src/pages/tags/index.astro
Normal file
|
|
@ -0,0 +1,44 @@
|
||||||
|
---
|
||||||
|
import BaseLayout from "../../layouts/BaseLayout.astro";
|
||||||
|
|
||||||
|
const tags = [
|
||||||
|
...new Set(
|
||||||
|
Object.values(import.meta.glob("../posts/*.md", { eager: true })).flatMap(
|
||||||
|
(post: any) => post.frontmatter.tags,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
];
|
||||||
|
---
|
||||||
|
|
||||||
|
<BaseLayout pageTitle="Tags">
|
||||||
|
<p>This is a list of all tags.</p>
|
||||||
|
<div class="tags">
|
||||||
|
{
|
||||||
|
tags.map((tag: any) => (
|
||||||
|
<p class="tag">
|
||||||
|
<a href={`/tags/${tag}`}>{tag}</a>
|
||||||
|
</p>
|
||||||
|
))
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
</BaseLayout>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
a {
|
||||||
|
color: #00539f;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tags {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tag {
|
||||||
|
margin: 0.25em;
|
||||||
|
border: dotted 1px #a1a1a1;
|
||||||
|
border-radius: 0.5em;
|
||||||
|
padding: 0.5em 1em;
|
||||||
|
font-size: 1.15em;
|
||||||
|
background-color: #f8fcfd;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
Loading…
Reference in a new issue