Skip to content

Commit

Permalink
feat(site/blog): adjust seo config
Browse files Browse the repository at this point in the history
  • Loading branch information
qhanw committed Oct 25, 2023
1 parent 5a99798 commit e1577dc
Show file tree
Hide file tree
Showing 5 changed files with 132 additions and 45 deletions.
10 changes: 10 additions & 0 deletions site/blog/app/components/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,16 @@ const nav = [
/>
),
},
// {
// name: "Notes",
// href: "/notes",
// icon: (props: any) => (
// <span
// {...props}
// className={clsx("i-heroicons:pencil-square", props.className)}
// />
// ),
// },
{
name: "Projects",
href: "/projects",
Expand Down
2 changes: 1 addition & 1 deletion site/blog/app/robots.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default function robots(): MetadataRoute.Robots {
rules: {
userAgent: "*",
allow: "/",
disallow: "/private/",
// disallow: "/private/",
},
sitemap: "https://qhan.wang/sitemap.xml",
};
Expand Down
44 changes: 0 additions & 44 deletions site/blog/app/sitemap.ts

This file was deleted.

93 changes: 93 additions & 0 deletions site/blog/app/sitemap.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">
<!-- created with Free Online Sitemap Generator www.xml-sitemaps.com -->
<url>
<loc>https://qhan.wang/</loc>
<lastmod>2023-10-25T10:37:00+00:00</lastmod>
<priority>1.00</priority>
</url>
<url>
<loc>https://qhan.wang/posts</loc>
<lastmod>2023-10-25T10:37:00+00:00</lastmod>
<priority>0.80</priority>
</url>
<url>
<loc>https://qhan.wang/projects</loc>
<lastmod>2023-10-25T10:37:00+00:00</lastmod>
<priority>0.80</priority>
</url>
<url>
<loc>https://qhan.wang/posts/next-mdx-blog</loc>
<lastmod>2023-10-25T10:37:00+00:00</lastmod>
<priority>0.64</priority>
</url>
<url>
<loc>https://qhan.wang/posts/ssr-timezone</loc>
<lastmod>2023-10-25T10:37:00+00:00</lastmod>
<priority>0.64</priority>
</url>
<url>
<loc>https://qhan.wang/posts/css-gradient-circle</loc>
<lastmod>2023-10-25T10:37:00+00:00</lastmod>
<priority>0.64</priority>
</url>
<url>
<loc>https://qhan.wang/posts/local-nginx-docker</loc>
<lastmod>2023-10-25T10:37:00+00:00</lastmod>
<priority>0.64</priority>
</url>
<url>
<loc>https://qhan.wang/posts/dnd-kit-ant-table</loc>
<lastmod>2023-10-25T10:37:00+00:00</lastmod>
<priority>0.64</priority>
</url>
<url>
<loc>https://qhan.wang/posts/test-playwright-auth</loc>
<lastmod>2023-10-25T10:37:00+00:00</lastmod>
<priority>0.64</priority>
</url>
<url>
<loc>https://qhan.wang/posts/css-aspect-ratio</loc>
<lastmod>2023-10-25T10:37:00+00:00</lastmod>
<priority>0.64</priority>
</url>
<url>
<loc>https://qhan.wang/posts/css-centered</loc>
<lastmod>2023-10-25T10:37:00+00:00</lastmod>
<priority>0.64</priority>
</url>
<url>
<loc>https://qhan.wang/posts/react-component-lifecycle</loc>
<lastmod>2023-10-25T10:37:00+00:00</lastmod>
<priority>0.64</priority>
</url>
<url>
<loc>https://qhan.wang/posts/cursor-position</loc>
<lastmod>2023-10-25T10:37:00+00:00</lastmod>
<priority>0.64</priority>
</url>
<url>
<loc>https://qhan.wang/posts/canvas-gen-thumbnail</loc>
<lastmod>2023-10-25T10:37:00+00:00</lastmod>
<priority>0.64</priority>
</url>
<url>
<loc>https://qhan.wang/posts/css-checkbox-beautify</loc>
<lastmod>2023-10-25T10:37:00+00:00</lastmod>
<priority>0.64</priority>
</url>
<url>
<loc>https://qhan.wang/posts/css-custom-scrollbar</loc>
<lastmod>2023-10-25T10:37:00+00:00</lastmod>
<priority>0.64</priority>
</url>
<url>
<loc>https://qhan.wang/posts/css-nth-child</loc>
<lastmod>2023-10-25T10:37:00+00:00</lastmod>
<priority>0.64</priority>
</url>
<url>
<loc>https://qhan.wang/posts/regexp</loc>
<lastmod>2023-10-25T10:37:00+00:00</lastmod>
<priority>0.64</priority>
</url>
</urlset>
28 changes: 28 additions & 0 deletions site/blog/app/sitemap_black.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { MetadataRoute } from "next";

import { getAllPosts } from "@/lib/posts";

export default async function sitemap(): Promise<MetadataRoute.Sitemap> {
// 远程获取博客列表
const posts = await getAllPosts();

const domain = `https://qhan.wang`;

// 转换为博客的 sitemap
const posts_maps: MetadataRoute.Sitemap = posts.map((post) => ({
url: `${domain}/posts/${post.slug}`,
lastModified: post.meta.lastModified?.toISOString(),
// changeFrequency: "daily",
priority: +(0.8 * 0.8).toFixed(2),
}));

// 加入本地的其他路由页面
const route_maps = ["/", "/posts", "/projects"].map((route) => ({
url: domain + route,
lastModified: new Date().toISOString(),
// changeFrequency: "weekly",
priority: route ? 0.8 : 1,
}));

return [...route_maps, ...posts_maps];
}

1 comment on commit e1577dc

@vercel
Copy link

@vercel vercel bot commented on e1577dc Oct 25, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

qhan – ./

qhan-qhanw.vercel.app
qhan.wang
www.qhan.wang
qhan-git-main-qhanw.vercel.app

Please sign in to comment.