Skip to content

Commit

Permalink
refactor: update feed handling and improve post navigation
Browse files Browse the repository at this point in the history
  • Loading branch information
Zhuxb-Clouds committed Jan 14, 2025
1 parent 2979e19 commit aeced70
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 15 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,5 @@ next-env.d.ts
yarn.lock


/public/feed.xml
/public/feed.xml
/public/feedCount.json
19 changes: 14 additions & 5 deletions pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ import { useEffect } from "react";
import Head from "next/head";
import Image from "next/image";
import style from "../styles/home.module.css";
import Link from "next/link";
import PostList, { postsData } from "../components/postList";
import { getSortedPostsData } from "../utils/posts";
import GithubSvg from "../public/github.svg";
import RssSvg from "../public/rss.svg";
import DarkModeSwitch from "../components/Header/DarkModeSwitch";
// instrumentation.ts
import { generateFeedXML } from "../utils/feed"

import { generateFeedXML } from "../utils/feed";

const homePage: NextPage<postsData> = ({ postsData }) => {
return (
Expand All @@ -30,13 +30,22 @@ const homePage: NextPage<postsData> = ({ postsData }) => {
<a target="view_window" href="https://github.com/Zhuxb-Clouds">
<Image src={GithubSvg} id="svg" alt="" width={20} height={20}></Image>
</a>
<a target="view_window" rel="alternate" type="application/rss+xml" title="RSS" href="/feed.xml">
<a
target="view_window"
rel="alternate"
type="application/rss+xml"
title="RSS"
href="/feed.xml"
>
<Image src={RssSvg} id="svg" alt="" width={20} height={20}></Image>
</a>
</div>
</div>
<div className={style.posts}>
<p>History Post</p>
<p>
<Link href="/posts">History Post</Link>
</p>

<PostList postsData={postsData} />
</div>
</div>
Expand All @@ -47,7 +56,7 @@ export default homePage;

export async function getStaticProps() {
const postsData = getSortedPostsData();
generateFeedXML()
generateFeedXML();
return {
props: {
postsData: postsData.slice(0, 12),
Expand Down
4 changes: 2 additions & 2 deletions pages/posts/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ const posts: NextPage<postsData> = ({ postsData }) => {
return (
<div>
<Head>
<title>Post - Zhuxb&apos; Blog</title>
<title>All Posts - Zhuxb&apos; Blog</title>
</Head>
<p>所有文章</p>
<p>All Posts</p>
<PostList postsData={postsData} />
</div>
);
Expand Down
4 changes: 0 additions & 4 deletions public/BingSiteAuth.xml

This file was deleted.

3 changes: 0 additions & 3 deletions public/feedCount.json

This file was deleted.

0 comments on commit aeced70

Please sign in to comment.