feat: personalize blog and update configurations

This commit is contained in:
KazooTTT
2025-02-05 20:35:05 +08:00
parent 4f55d62fb6
commit f22b2529e8
20 changed files with 314 additions and 50 deletions

View File

@ -9,28 +9,5 @@ const meta = {
<PageLayout meta={meta}>
<h1 class="title mb-6">About</h1>
<div class="prose prose-sm prose-cactus max-w-none">
<p>
Hi, Im a starter Astro. Im particularly great for getting you started with your own blogging
website.
</p>
<p>Here are my some of my awesome built in features:</p>
<ul class="list-inside list-disc" role="list">
<li>I'm ultra fast as I'm a static site</li>
<li>I'm fully responsive</li>
<li>I come with a light and dark mode</li>
<li>I'm easy to customise and add additional content</li>
<li>I have Tailwind CSS styling</li>
<li>Shiki code syntax highlighting</li>
<li>Satori for auto generating OG images for blog posts</li>
</ul>
<p>
Clone or fork my <a
class="cactus-link inline-block"
href="https://github.com/chrismwilliams/astro-cactus"
rel="noreferrer"
target="_blank">repo</a
> if you like me!
</p>
</div>
<div class="prose prose-sm prose-cactus max-w-none">TODO ...</div>
</PageLayout>

78
src/pages/friends.astro Normal file
View File

@ -0,0 +1,78 @@
---
import BaseLayout from "@/layouts/Base.astro";
const friends: { name: string; url: string; description?: string }[] = [
{
name: "Yuang's Blog",
url: "https://yuuuuang.com/",
},
{
name: "huaiying",
url: "https://blog.csdn.net/huaiyingdetective",
},
{
name: "Sorry404 Wang",
url: "http://40404.site/",
},
{
name: "lijinghua",
url: "www.lijinghua.club",
},
{
name: "思无道",
url: "https://siwudao.github.io/",
},
{
name: "Kai",
url: "https://kaiyi.cool/",
},
{
name: "buyfakett",
url: "https://www.tteam.icu/",
},
{
name: "poivre",
url: "https://blog.poivrehxx.site/",
},
{
name: `Roi's Blog`,
url: "https://roi.moe/",
},
];
---
<BaseLayout
meta={{
title: `Friends`,
description: "my friends ",
}}
>
<div class="container mx-auto px-4 py-8">
<h1 class="title mb-6">Friends</h1>
<div class="grid grid-cols-1 gap-6 md:grid-cols-2">
{
friends.map((friend) => (
<a
href={friend.url.startsWith("http") ? friend.url : `https://${friend.url}`}
target="_blank"
rel="noopener noreferrer"
class="block rounded-lg bg-white p-6 shadow-md transition-shadow duration-300 hover:shadow-lg dark:bg-gray-800"
>
<h2 class="text-xl font-semibold">{friend.name}</h2>
{friend.description && (
<p class="mt-2 truncate text-sm text-gray-600 dark:text-gray-400">
{friend.description}
</p>
)}
</a>
))
}
</div>
</div>
</BaseLayout>
<style>
.container {
max-width: 1200px;
}
</style>

View File

@ -23,11 +23,7 @@ const latestNotes = allNotes.sort(collectionDateSort).slice(0, MAX_NOTES);
<PageLayout meta={{ title: "Home" }}>
<section>
<h1 class="title mb-6">Hello World!</h1>
<p class="mb-4">
Hi, Im a theme for Astro, a simple starter that you can use to create your website or blog.
If you want to know more about how you can customise me, add more posts, and make it your own,
click on the GitHub icon link below and it will take you to my repo.
</p>
<p class="mb-4">TODO ...</p>
<SocialList />
</section>
<section class="mt-16">

View File

@ -22,6 +22,7 @@ const meta = {
description:
note.data.description || `Read about my note posted on: ${note.data.date.toLocaleDateString()}`,
title: note.data.title,
tags: note.data.tags.join(", "),
};
---

View File

@ -1,19 +1,37 @@
import { getAllPosts } from "@/data/post";
import { siteConfig } from "@/site.config";
import { collectionDateSort } from "@/utils/date";
import rss from "@astrojs/rss";
import MarkdownIt from "markdown-it";
import sanitizeHtml from "sanitize-html";
export const GET = async () => {
const posts = await getAllPosts();
const sortedPosts = posts.sort(collectionDateSort);
const parser = new MarkdownIt();
return rss({
customData: `<follow_challenge>
<feedId>75113012474671104</feedId>
<userId>62156866798228480</userId>
</follow_challenge>`,
title: siteConfig.title,
description: siteConfig.description,
site: import.meta.env.SITE,
items: posts.map((post) => ({
items: sortedPosts.map((post) => ({
title: post.data.title,
description: post.data.description ?? "",
pubDate: post.data.date,
link: `posts/${post.id}/`,
content: post.body
? sanitizeHtml(parser.render(post.body), {
allowedTags: sanitizeHtml.defaults.allowedTags.concat(["img"]),
textFilter: function (text: string) {
return text.replace(/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x9F\uFFF0-\uFFFF]/g, "");
},
})
: "",
author: siteConfig.author,
})),
});
};