Skip to content

Commit

Permalink
feat(site/blog): add middleware
Browse files Browse the repository at this point in the history
  • Loading branch information
qhanw committed Oct 12, 2024
1 parent d23adfa commit b41318f
Show file tree
Hide file tree
Showing 4 changed files with 339 additions and 3 deletions.
6 changes: 3 additions & 3 deletions site/blog/app/(web)/components/Theme.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ export default function Theme() {
const isDark = theme === "dark";

return (
<a
<span
onClick={() => setTheme(isDark ? "light" : "dark")}
className="text-slate-600 dark:text-slate-200 cursor-pointer"
className="text-slate-600 dark:text-slate-300 hover:text-slate-800 dark:hover:text-slate-100 cursor-pointer"
>
<i className={isDark ? "i-ri:sun-fill" : "i-ri:moon-fill"} />
</a>
</span>
);
}
11 changes: 11 additions & 0 deletions site/blog/app/middleware.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
export const config = {
matcher: [
/*
* Match all request paths except for the ones starting with:
* - _next/static (static files)
* - _next/image (image optimization files)
* - favicon.ico, sitemap.xml, robots.txt (metadata files)
*/
"/((?!_next/static|_next/image|favicon.ico|sitemap.xml|robots.txt).*)",
],
};
103 changes: 103 additions & 0 deletions site/blog/public/sitemap-a.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>https://qhan.wang</loc>
<lastmod>2024-10-12T04:18:52.839Z</lastmod>
</url>
<url>
<loc>https://qhan.wang/posts</loc>
<lastmod>2024-10-12T04:18:52.839Z</lastmod>
</url>
<url>
<loc>https://qhan.wang/projects</loc>
<lastmod>2024-10-12T04:18:52.839Z</lastmod>
</url>
<url>
<loc>https://qhan.wang/posts/nginx-websocket</loc>
<lastmod>2024-08-14T09:47:15.000Z</lastmod>
</url>
<url>
<loc>https://qhan.wang/posts/geometry-calculation</loc>
<lastmod>2024-08-14T06:54:07.000Z</lastmod>
</url>
<url>
<loc>https://qhan.wang/posts/clipper-lib-guide</loc>
<lastmod>2024-08-14T06:54:07.000Z</lastmod>
</url>
<url>
<loc>https://qhan.wang/posts/pixijs-custom-cursor</loc>
<lastmod>2024-08-14T06:54:07.000Z</lastmod>
</url>
<url>
<loc>https://qhan.wang/posts/git-common-commands</loc>
<lastmod>2024-08-14T06:54:07.000Z</lastmod>
</url>
<url>
<loc>https://qhan.wang/posts/next-unocss</loc>
<lastmod>2024-08-14T06:54:07.000Z</lastmod>
</url>
<url>
<loc>https://qhan.wang/posts/next-mdx-contentlayer</loc>
<lastmod>2024-08-14T06:54:07.000Z</lastmod>
</url>
<url>
<loc>https://qhan.wang/posts/next-mdx</loc>
<lastmod>2024-08-14T06:54:07.000Z</lastmod>
</url>
<url>
<loc>https://qhan.wang/posts/ssr-timezone</loc>
<lastmod>2024-08-14T06:54:07.000Z</lastmod>
</url>
<url>
<loc>https://qhan.wang/posts/css-gradient-circle</loc>
<lastmod>2024-08-14T06:54:07.000Z</lastmod>
</url>
<url>
<loc>https://qhan.wang/posts/local-nginx-docker</loc>
<lastmod>2024-08-14T06:54:07.000Z</lastmod>
</url>
<url>
<loc>https://qhan.wang/posts/dnd-kit-ant-table</loc>
<lastmod>2024-08-14T06:54:07.000Z</lastmod>
</url>
<url>
<loc>https://qhan.wang/posts/test-playwright-auth</loc>
<lastmod>2024-08-14T06:54:07.000Z</lastmod>
</url>
<url>
<loc>https://qhan.wang/posts/browser-cache</loc>
<lastmod>2024-08-14T06:54:07.000Z</lastmod>
</url>
<url>
<loc>https://qhan.wang/posts/css-aspect-ratio</loc>
<lastmod>2024-08-14T06:54:07.000Z</lastmod>
</url>
<url>
<loc>https://qhan.wang/posts/css-centered</loc>
<lastmod>2024-08-14T06:54:07.000Z</lastmod>
</url>
<url>
<loc>https://qhan.wang/posts/react-component-lifecycle</loc>
<lastmod>2024-08-14T06:54:07.000Z</lastmod>
</url>
<url>
<loc>https://qhan.wang/posts/cursor-position</loc>
<lastmod>2024-08-14T06:54:07.000Z</lastmod>
</url>
<url>
<loc>https://qhan.wang/posts/css-checkbox-beautify</loc>
<lastmod>2024-08-14T06:54:07.000Z</lastmod>
</url>
<url>
<loc>https://qhan.wang/posts/css-custom-scrollbar</loc>
<lastmod>2024-08-14T06:54:07.000Z</lastmod>
</url>
<url>
<loc>https://qhan.wang/posts/css-nth-child</loc>
<lastmod>2024-08-14T06:54:07.000Z</lastmod>
</url>
<url>
<loc>https://qhan.wang/posts/regexp</loc>
<lastmod>2024-08-14T06:54:07.000Z</lastmod>
</url>
</urlset>
222 changes: 222 additions & 0 deletions site/blog/public/sitemap-b.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,222 @@
<?xml version="1.0" encoding="UTF-8"?>
<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>2024-10-12T04:41:30+00:00</lastmod>
<priority>1.00</priority>
</url>
<url>
<loc>https://qhan.wang/posts</loc>
<lastmod>2024-10-12T04:41:30+00:00</lastmod>
<priority>0.80</priority>
</url>
<url>
<loc>https://qhan.wang/code-snippets</loc>
<lastmod>2024-10-12T04:41:30+00:00</lastmod>
<priority>0.80</priority>
</url>
<url>
<loc>https://qhan.wang/tools</loc>
<lastmod>2024-10-12T04:41:30+00:00</lastmod>
<priority>0.80</priority>
</url>
<url>
<loc>https://qhan.wang/posts/nginx-websocket</loc>
<lastmod>2024-10-12T04:41:30+00:00</lastmod>
<priority>0.64</priority>
</url>
<url>
<loc>https://qhan.wang/posts/geometry-calculation</loc>
<lastmod>2024-10-12T04:41:30+00:00</lastmod>
<priority>0.64</priority>
</url>
<url>
<loc>https://qhan.wang/posts/clipper-lib-guide</loc>
<lastmod>2024-10-12T04:41:30+00:00</lastmod>
<priority>0.64</priority>
</url>
<url>
<loc>https://qhan.wang/posts/pixijs-custom-cursor</loc>
<lastmod>2024-10-12T04:41:30+00:00</lastmod>
<priority>0.64</priority>
</url>
<url>
<loc>https://qhan.wang/posts/git-common-commands</loc>
<lastmod>2024-10-12T04:41:30+00:00</lastmod>
<priority>0.64</priority>
</url>
<url>
<loc>https://qhan.wang/posts/next-unocss</loc>
<lastmod>2024-10-12T04:41:30+00:00</lastmod>
<priority>0.64</priority>
</url>
<url>
<loc>https://qhan.wang/posts/next-mdx-contentlayer</loc>
<lastmod>2024-10-12T04:41:30+00:00</lastmod>
<priority>0.64</priority>
</url>
<url>
<loc>https://qhan.wang/posts/next-mdx</loc>
<lastmod>2024-10-12T04:41:30+00:00</lastmod>
<priority>0.64</priority>
</url>
<url>
<loc>https://qhan.wang/posts/ssr-timezone</loc>
<lastmod>2024-10-12T04:41:30+00:00</lastmod>
<priority>0.64</priority>
</url>
<url>
<loc>https://qhan.wang/posts/css-gradient-circle</loc>
<lastmod>2024-10-12T04:41:30+00:00</lastmod>
<priority>0.64</priority>
</url>
<url>
<loc>https://qhan.wang/posts/local-nginx-docker</loc>
<lastmod>2024-10-12T04:41:30+00:00</lastmod>
<priority>0.64</priority>
</url>
<url>
<loc>https://qhan.wang/posts/dnd-kit-ant-table</loc>
<lastmod>2024-10-12T04:41:30+00:00</lastmod>
<priority>0.64</priority>
</url>
<url>
<loc>https://qhan.wang/posts/test-playwright-auth</loc>
<lastmod>2024-10-12T04:41:30+00:00</lastmod>
<priority>0.64</priority>
</url>
<url>
<loc>https://qhan.wang/posts/browser-cache</loc>
<lastmod>2024-10-12T04:41:30+00:00</lastmod>
<priority>0.64</priority>
</url>
<url>
<loc>https://qhan.wang/posts/css-aspect-ratio</loc>
<lastmod>2024-10-12T04:41:30+00:00</lastmod>
<priority>0.64</priority>
</url>
<url>
<loc>https://qhan.wang/posts/css-centered</loc>
<lastmod>2024-10-12T04:41:30+00:00</lastmod>
<priority>0.64</priority>
</url>
<url>
<loc>https://qhan.wang/posts/react-component-lifecycle</loc>
<lastmod>2024-10-12T04:41:30+00:00</lastmod>
<priority>0.64</priority>
</url>
<url>
<loc>https://qhan.wang/posts/cursor-position</loc>
<lastmod>2024-10-12T04:41:30+00:00</lastmod>
<priority>0.64</priority>
</url>
<url>
<loc>https://qhan.wang/posts/css-checkbox-beautify</loc>
<lastmod>2024-10-12T04:41:30+00:00</lastmod>
<priority>0.64</priority>
</url>
<url>
<loc>https://qhan.wang/posts/css-custom-scrollbar</loc>
<lastmod>2024-10-12T04:41:30+00:00</lastmod>
<priority>0.64</priority>
</url>
<url>
<loc>https://qhan.wang/posts/css-nth-child</loc>
<lastmod>2024-10-12T04:41:30+00:00</lastmod>
<priority>0.64</priority>
</url>
<url>
<loc>https://qhan.wang/posts/regexp</loc>
<lastmod>2024-10-12T04:41:30+00:00</lastmod>
<priority>0.64</priority>
</url>
<url>
<loc>https://qhan.wang/code-snippets/antd-tree</loc>
<lastmod>2024-10-12T04:41:30+00:00</lastmod>
<priority>0.64</priority>
</url>
<url>
<loc>https://qhan.wang/code-snippets/debounce-and-throttle</loc>
<lastmod>2024-10-12T04:41:30+00:00</lastmod>
<priority>0.64</priority>
</url>
<url>
<loc>https://qhan.wang/code-snippets/array-to-tree</loc>
<lastmod>2024-10-12T04:41:30+00:00</lastmod>
<priority>0.64</priority>
</url>
<url>
<loc>https://qhan.wang/code-snippets/recursive-lookup</loc>
<lastmod>2024-10-12T04:41:30+00:00</lastmod>
<priority>0.64</priority>
</url>
<url>
<loc>https://qhan.wang/code-snippets/array-set-calculation</loc>
<lastmod>2024-10-12T04:41:30+00:00</lastmod>
<priority>0.64</priority>
</url>
<url>
<loc>https://qhan.wang/code-snippets/auto-time-update</loc>
<lastmod>2024-10-12T04:41:30+00:00</lastmod>
<priority>0.64</priority>
</url>
<url>
<loc>https://qhan.wang/code-snippets/hash-time-33</loc>
<lastmod>2024-10-12T04:41:30+00:00</lastmod>
<priority>0.64</priority>
</url>
<url>
<loc>https://qhan.wang/code-snippets/javascript-download</loc>
<lastmod>2024-10-12T04:41:30+00:00</lastmod>
<priority>0.64</priority>
</url>
<url>
<loc>https://qhan.wang/code-snippets/search-param</loc>
<lastmod>2024-10-12T04:41:30+00:00</lastmod>
<priority>0.64</priority>
</url>
<url>
<loc>https://qhan.wang/code-snippets/modal-hidden-self</loc>
<lastmod>2024-10-12T04:41:30+00:00</lastmod>
<priority>0.64</priority>
</url>
<url>
<loc>https://qhan.wang/code-snippets/react-context-api</loc>
<lastmod>2024-10-12T04:41:30+00:00</lastmod>
<priority>0.64</priority>
</url>
<url>
<loc>https://qhan.wang/code-snippets/modal</loc>
<lastmod>2024-10-12T04:41:30+00:00</lastmod>
<priority>0.64</priority>
</url>
<url>
<loc>https://qhan.wang/code-snippets/delete-key</loc>
<lastmod>2024-10-12T04:41:30+00:00</lastmod>
<priority>0.64</priority>
</url>
<url>
<loc>https://qhan.wang/code-snippets/deep-clone</loc>
<lastmod>2024-10-12T04:41:30+00:00</lastmod>
<priority>0.64</priority>
</url>
<url>
<loc>https://qhan.wang/code-snippets/deduplication</loc>
<lastmod>2024-10-12T04:41:30+00:00</lastmod>
<priority>0.64</priority>
</url>
<url>
<loc>https://qhan.wang/code-snippets/js-sort</loc>
<lastmod>2024-10-12T04:41:30+00:00</lastmod>
<priority>0.64</priority>
</url>


</urlset>

0 comments on commit b41318f

Please sign in to comment.