From c25e8b7e4d6b10eea2ba93f34db7322713a44201 Mon Sep 17 00:00:00 2001 From: Lumither Tao Date: Sat, 27 Apr 2024 15:41:34 +0800 Subject: [PATCH] feat(doc) EOL documentation of the branch --- README.md | 97 +++++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 72 insertions(+), 25 deletions(-) diff --git a/README.md b/README.md index c403366..7d6f327 100644 --- a/README.md +++ b/README.md @@ -1,36 +1,83 @@ -This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app). +# This branch was deprecated. -## Getting Started +In the initial plan of the blog, `raw.githubusercontent.com///` (or any other git server) +was used as the cdn for the blog website, which also come with VCS without effort. -First, run the development server: +The idea is to build a separate repo that will be served as a database in ideal blog system structure, and all the +functionality related to CMS will be hosted by cloudflare worker. ```bash -npm run dev -# or -yarn dev -# or -pnpm dev -# or -bun dev +master > tree 4s 19:32:15 +. +├── idx.json +└── posts + ├── another_article.md + ├── hello_world.md + └── idx.json + +2 directories, 3 files ``` -Open [http://localhost:3000](http://localhost:3000) with your browser to see the result. +This is an example of [db repo](https://github.com/Lumither/blog-posts.git). -You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file. +```bash -This project uses [`next/font`](https://nextjs.org/docs/basic-features/font-optimization) to automatically optimize and load Inter, a custom Google Font. +master > cat idx.json 15:08:34 +{ + "idx": [ + { + "type": "dir", + "name": "posts" + } + ] +} +master > cat ./posts/idx.json 15:09:53 +{ + "idx": [ + { + "type": "md", + "name": "another_article.md", + "meta": { + "title": "another_article!", + "desc": "test", + "tag": ["blog", "test", "dev"] + } + }, + { + "type": "md", + "name": "hello_world.md", + "meta": { + "title": "Hello World!", + "desc": "test", + "tag": ["blog", "test", "dev"] + } + } + ] +} +``` -## Learn More +These are examples of `idx.json`. They were designed to be placed at any layer of the directory, and used +to accelerate the client side browsing. The following is an easy [implementation](/app/blog/fetch_posts.ts) of using `idx.json` at `/posts` +to get a list of blog posts. -To learn more about Next.js, take a look at the following resources: +```ts +export default async function fetch_posts(url: string): Promise> { + const response = await fetch(`${ url }/posts/idx.json`); + if (!response.ok) { + return { + ok: false, + error: new Error(response.statusText) + }; + } + const res = await response.json(); + const posts = res['idx'].filter((posts: { type: string }) => posts.type === 'md'); + return { + ok: true, + value: posts + }; +} +``` -- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API. -- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial. - -You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome! - -## Deploy on Vercel - -The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js. - -Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details. +The approach work impressively well, thanks for the globe services of GitHub lol, but eventually the plan was changed +due to ethical reasons and possibility of breaking GitHub's EULA. Plus, the functionality of the blog site might be constrained due to +Cloudflare worker's CPU time limitations, considering the existence of potential resource-intense work such as on-site searching and analytics.