* fixed css fuckup

Signed-off-by: Ash Entwisle <ash.entwisle@protonmail.com>

* tweaked css

Signed-off-by: Ash Entwisle <ash.entwisle@protonmail.com>

* tweaked css

Signed-off-by: Ash Entwisle <ash.entwisle@protonmail.com>

* updated exec names

Signed-off-by: Ash Entwisle <ash.entwisle@protonmail.com>

* fixed blogpost sort (#30)

Signed-off-by: Ash Entwisle <ash.entwisle@protonmail.com>

* Hotfix/done goofery (#32)

* fixed blogpost sort

Signed-off-by: Ash Entwisle <ash.entwisle@protonmail.com>

* forgor to change the path of my pfp lol

Signed-off-by: Ash Entwisle <ash.entwisle@protonmail.com>

---------

Signed-off-by: Ash Entwisle <ash.entwisle@protonmail.com>

* Revert "Bugfix/blogpost sort (#28)" (#29)

This reverts commit 58f452c9bb.

---------

Signed-off-by: Ash Entwisle <ash.entwisle@protonmail.com>
main
Ash 2024-07-17 20:55:58 +01:00 committed by GitHub
parent 6388bbd180
commit 1376a56766
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 36 additions and 34 deletions

View File

@ -3,7 +3,6 @@ import Center from "../components/base/Center.astro";
import Icon from "../components/base/Icon.astro";
import Boilerplate from "../layouts/Boilerplate.astro";
const rawPosts = await Astro.glob("./posts/*.mdx");
const search = Astro.url.searchParams.get("q") || "";
@ -13,15 +12,14 @@ const posts = rawPosts
return {
url: post.url ?? "/",
data: post.frontmatter,
}
};
});
const filteredPosts = posts.filter((post) => {
return post.data.title.toLowerCase()
.includes(search.toLowerCase())
||
post.data.description.toLowerCase()
.includes(search.toLowerCase());
return (
post.data.title.toLowerCase().includes(search.toLowerCase()) ||
post.data.description.toLowerCase().includes(search.toLowerCase())
);
});
// sort posts in decscending order of date
@ -29,10 +27,6 @@ filteredPosts.sort((a, b) => {
return a.data.date < b.data.date ? 1 : -1;
});
const keywords = [
"hull",
"computer",
@ -63,7 +57,12 @@ const keywords = [
<div class="blog_search">
<Center id="search">
<form action="/blog" method="get">
<input type="text" name="q" placeholder={search || "Search..."} value="" />
<input
type="text"
name="q"
placeholder={search || "Search..."}
value=""
/>
<button type="submit">
<Icon icon={{ code: "f002", bold: true }} />
</button>
@ -81,13 +80,20 @@ const keywords = [
{/* <span class="blog_post_link"><Icon icon={{code: "f0c1", bold: true}}/></span> */}
</a>
</h2>
<p>
{post.data.description}
</p>
<h3><em>
<span class="blog_post_author"> By: <a href={post.data.link}> @{post.data.author.replace(" ", "_").toLowerCase()}</a> </span>
<p>{post.data.description}</p>
<h3>
<em>
<span class="blog_post_author">
{" "}
By:{" "}
<a href={post.data.link}>
{" "}
@{post.data.author.replace(" ", "_").toLowerCase()}
</a>{" "}
</span>
<span class="blog_post_date"> ({post.data.date}) </span>
</em></h3>
</em>
</h3>
</div>
))
}
@ -97,13 +103,9 @@ const keywords = [
<script>
document.addEventListener("keydown", (e) => {
if (
e.key === "k" && (e.metaKey || e.ctrlKey) ||
e.key === "/"
) {
if ((e.key === "k" && (e.metaKey || e.ctrlKey)) || e.key === "/") {
e.preventDefault();
document.querySelector("input")?.focus();
}
});
</script>