mirror of
https://github.com/KazooTTT/kazoottt-blog.git
synced 2025-06-23 18:51:31 +08:00
feat: add sitemap
This commit is contained in:
66
src/pages/friends.astro
Normal file
66
src/pages/friends.astro
Normal file
@ -0,0 +1,66 @@
|
||||
---
|
||||
import BaseLayout from '../layouts/BaseLayout.astro'
|
||||
|
||||
const friends = [
|
||||
{
|
||||
name: '大咩整装待发',
|
||||
url: 'https://www.mihuashi.com/profiles/283847?role=painter'
|
||||
},
|
||||
{
|
||||
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/'
|
||||
}
|
||||
]
|
||||
---
|
||||
|
||||
<BaseLayout
|
||||
meta={{
|
||||
title: `Friends`,
|
||||
description: 'my friends '
|
||||
}}
|
||||
>
|
||||
<div class='container mx-auto px-4 py-8'>
|
||||
<h1 class='mb-8 text-3xl font-bold'>Friends</h1>
|
||||
<div class='grid grid-cols-1 gap-6 md:grid-cols-2 lg:grid-cols-3'>
|
||||
{
|
||||
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='mb-2 text-xl font-semibold'>{friend.name}</h2>
|
||||
<p class='truncate text-sm text-gray-600 dark:text-gray-400'>{friend.url}</p>
|
||||
</a>
|
||||
))
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</BaseLayout>
|
||||
|
||||
<style>
|
||||
.container {
|
||||
max-width: 1200px;
|
||||
}
|
||||
</style>
|
@ -94,15 +94,18 @@ const projects = [...directProjects, ...mdProjects].slice(0, MAX_PROJECTS)
|
||||
</section>
|
||||
|
||||
<Section title='About'>
|
||||
<div class='text-muted-foreground space-y-2'>
|
||||
<p>你是一位专注于前端开发的工程师,深度使用 React 技术栈。通过持续学习和实践,你在现代前端工程化方面积累了丰富经验。</p>
|
||||
<div class='space-y-2 text-muted-foreground'>
|
||||
<p>
|
||||
你是一位专注于前端开发的工程师,深度使用 React
|
||||
技术栈。通过持续学习和实践,你在现代前端工程化方面积累了丰富经验。
|
||||
</p>
|
||||
<p>你的技术栈:</p>
|
||||
<ul class="list-disc list-inside ml-2 mt-1">
|
||||
<ul class='ml-2 mt-1 list-inside list-disc'>
|
||||
<li>基于 React 生态系统进行 Web 应用开发</li>
|
||||
<li>使用 VTK.js 探索数据可视化领域</li>
|
||||
<li>具备 Python 和 Node.js 全栈开发经验</li>
|
||||
</ul>
|
||||
<p class="mt-2">保持技术热情,持续学习成长中 🌱</p>
|
||||
<p class='mt-2'>保持技术热情,持续学习成长中 🌱</p>
|
||||
</div>
|
||||
</Section>
|
||||
{
|
||||
|
70
src/pages/sitemap.xml.js
Normal file
70
src/pages/sitemap.xml.js
Normal file
@ -0,0 +1,70 @@
|
||||
import rss from '@astrojs/rss'
|
||||
import { siteConfig } from '@/site-config'
|
||||
import { getAllSortedPosts } from '@/utils'
|
||||
|
||||
export const GET = async () => {
|
||||
const posts = await getAllSortedPosts()
|
||||
|
||||
const items = await Promise.all(
|
||||
posts.map(async (post) => {
|
||||
const entry = post
|
||||
const body = entry.body
|
||||
|
||||
return {
|
||||
title: post.data.title ?? '',
|
||||
description: JSON.stringify(body),
|
||||
pubDate: post.data.date,
|
||||
link: `/blog/${post.slug}`
|
||||
}
|
||||
})
|
||||
)
|
||||
|
||||
const link = import.meta.env.SITE
|
||||
const locale = ''
|
||||
|
||||
const defaultFields = [
|
||||
{
|
||||
loc: `${link}${locale}`,
|
||||
lastmod: new Date().toISOString().split('T')[0],
|
||||
changefreq: 'daily',
|
||||
priority: '1.0'
|
||||
},
|
||||
{
|
||||
loc: `${link}${locale}/blog`,
|
||||
lastmod: new Date().toISOString().split('T')[0],
|
||||
changefreq: 'daily',
|
||||
priority: '0.8'
|
||||
},
|
||||
{
|
||||
loc: `${link}${locale}/categories`,
|
||||
lastmod: new Date().toISOString().split('T')[0],
|
||||
changefreq: 'daily',
|
||||
priority: '0.7'
|
||||
},
|
||||
{
|
||||
loc: `${link}${locale}/tags`,
|
||||
lastmod: new Date().toISOString().split('T')[0],
|
||||
changefreq: 'daily',
|
||||
priority: '0.7'
|
||||
},
|
||||
{
|
||||
loc: `${link}${locale}/tools`,
|
||||
lastmod: new Date().toISOString().split('T')[0],
|
||||
changefreq: 'weekly',
|
||||
priority: '0.6'
|
||||
},
|
||||
{
|
||||
loc: `${link}${locale}/rss.xml`,
|
||||
lastmod: new Date().toISOString().split('T')[0],
|
||||
changefreq: 'daily',
|
||||
priority: '0.4'
|
||||
}
|
||||
]
|
||||
|
||||
return rss({
|
||||
title: siteConfig.title,
|
||||
description: siteConfig.description + '\nfeedId:76245438397618182+userId:62156866798228480',
|
||||
site: import.meta.env.SITE,
|
||||
items: [...defaultFields, ...items]
|
||||
})
|
||||
}
|
Reference in New Issue
Block a user