mirror of
https://github.com/Fluffy-Bean/website.git
synced 2025-06-21 01:50:35 +00:00
Tags and Filtering
Yeet projects, as they're identical to posts in every way but name Add OpenGraph for SEO Add Plugin prop to Layout to avoid loading unnecessary JS and CSS
This commit is contained in:
parent
745ac58045
commit
291552c340
21 changed files with 336 additions and 212 deletions
36
src/pages/search/index.astro
Normal file
36
src/pages/search/index.astro
Normal file
|
@ -0,0 +1,36 @@
|
|||
---
|
||||
import { getCollection} from "astro:content";
|
||||
|
||||
import { getPosts } from "../../utils";
|
||||
import Layout from "../../layouts/Layout.astro";
|
||||
import HomeButton from "../../components/HomeButton.astro";
|
||||
|
||||
const tags = await getCollection("tags");
|
||||
const posts = await getPosts("posts");
|
||||
tags.forEach((tag) => {
|
||||
tag.data.postCount = posts.filter((project) => {
|
||||
return project.data.tags.includes(tag.slug);
|
||||
}).length;
|
||||
})
|
||||
---
|
||||
|
||||
<Layout title="Leggy Land - All Projects">
|
||||
<HomeButton />
|
||||
|
||||
<div class="header">
|
||||
<h1>Search</h1>
|
||||
<p>Filter posts by tags</p>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
|
||||
<ul role="list" class="pill-list">
|
||||
{tags.map(tag => (
|
||||
<li>
|
||||
<a class="button" href=`/search/${tag.slug}`>
|
||||
{tag.data.name} {tag.data.postCount}
|
||||
</a>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</Layout>
|
Loading…
Add table
Add a link
Reference in a new issue