|
1 | | -# 🍥Fuwari |
| 1 | +# Notion Astro Rev - A Notion-Astro Blog Template |
2 | 2 |
|
3 | | -A static blog template built with [Astro](https://astro.build). |
| 3 | +> Base Blog Template: [fuwari](https://github.com/saicaca/fuwari) |
| 4 | +> |
| 5 | +> This doc is generated by Claude 3.7 & Windsurf based on project info |
4 | 6 |
|
5 | | -[**🖥️ Live Demo (Vercel)**](https://fuwari.vercel.app) / |
6 | | -[**📦 Old Hexo Version**](https://github.com/saicaca/hexo-theme-vivia) / |
7 | | -[**🌏 中文**](https://github.com/saicaca/fuwari/blob/main/README.zh-CN.md) / |
8 | | -[**🌏 日本語**](https://github.com/saicaca/fuwari/blob/main/README.ja-JP.md) / |
9 | | -[**🌏 한국어**](https://github.com/saicaca/fuwari/blob/main/README.ko.md) / |
10 | | -[**🌏 Español**](https://github.com/saicaca/fuwari/blob/main/README.es.md) / |
11 | | -[**🌏 ไทย**](https://github.com/saicaca/fuwari/blob/main/README.th.md) |
| 7 | +A modern blog template built with [Astro](https://astro.build) and powered by [notion-astro-loader](https://github.com/KiritoKing/notion-astro-loader) for seamless Notion integration. |
12 | 8 |
|
13 | | -> README version: `2024-09-10` |
| 9 | +[**🌏 中文文档**](./README.zh-CN.md) |
14 | 10 |
|
15 | | - |
| 11 | +> README version: `2025-04-17` |
| 12 | +
|
| 13 | +## 🌟 Introduction |
| 14 | + |
| 15 | +This project serves as a template blog for the `notion-astro-loader` package, allowing you to create a beautiful, fast, and SEO-friendly blog using Notion as your CMS. With this template, you can: |
| 16 | + |
| 17 | +- Write and manage your blog content in Notion |
| 18 | +- Automatically sync content to your Astro-powered blog |
| 19 | +- Enjoy a modern, responsive design with smooth animations |
| 20 | +- Customize the appearance to match your personal style |
| 21 | +- Easily deploy to platforms like Vercel, Netlify, or GitHub Pages |
16 | 22 |
|
17 | 23 | ## ✨ Features |
18 | 24 |
|
19 | | -- [x] Built with [Astro](https://astro.build) and [Tailwind CSS](https://tailwindcss.com) |
20 | | -- [x] Smooth animations and page transitions |
21 | | -- [x] Light / dark mode |
22 | | -- [x] Customizable theme colors & banner |
23 | | -- [x] Responsive design |
24 | | -- [ ] Comments |
25 | | -- [x] Search |
26 | | -- [ ] TOC |
27 | | - |
28 | | -## 🚀 How to Use |
29 | | - |
30 | | -1. [Generate a new repository](https://github.com/saicaca/fuwari/generate) from this template or fork this repository. |
31 | | -2. To edit your blog locally, clone your repository, run `pnpm install` AND `pnpm add sharp` to install dependencies. |
32 | | - - Install [pnpm](https://pnpm.io) `npm install -g pnpm` if you haven't. |
33 | | -3. Edit the config file `src/config.ts` to customize your blog. |
34 | | -4. Run `pnpm new-post <filename>` to create a new post and edit it in `src/content/posts/`. |
35 | | -5. Deploy your blog to Vercel, Netlify, GitHub Pages, etc. following [the guides](https://docs.astro.build/en/guides/deploy/). You need to edit the site configuration in `astro.config.mjs` before deployment. |
36 | | - |
37 | | -## ⚙️ Frontmatter of Posts |
38 | | - |
39 | | -```yaml |
40 | | ---- |
41 | | -title: My First Blog Post |
42 | | -published: 2023-09-09 |
43 | | -description: This is the first post of my new Astro blog. |
44 | | -image: ./cover.jpg |
45 | | -tags: [Foo, Bar] |
46 | | -category: Front-end |
47 | | -draft: false |
48 | | -lang: jp # Set only if the post's language differs from the site's language in `config.ts` |
49 | | ---- |
| 25 | +- [x] **Notion Integration**: Use Notion as your CMS with `notion-astro-loader` |
| 26 | +- [x] **Modern Design**: Built with Astro and Tailwind CSS |
| 27 | +- [x] **Performance**: Static site generation for optimal speed |
| 28 | +- [x] **Smooth Transitions**: Page transitions and animations |
| 29 | +- [x] **Theming**: Light/dark mode and customizable theme colors |
| 30 | +- [x] **Responsive**: Mobile-friendly design |
| 31 | +- [x] **Search**: Built-in search functionality |
| 32 | +- [x] **URL Migration**: Tools for migrating from other blog platforms |
| 33 | +- [x] **E2E Testing**: Playwright tests for URL redirects and functionality |
| 34 | + |
| 35 | +## 🚀 Getting Started |
| 36 | + |
| 37 | +### Prerequisites |
| 38 | + |
| 39 | +- [Node.js](https://nodejs.org/) (v18 or later) |
| 40 | +- [pnpm](https://pnpm.io/) (recommended package manager) |
| 41 | +- A Notion account with a database for your blog posts |
| 42 | + |
| 43 | +### Setup |
| 44 | + |
| 45 | +1. Clone this repository: |
| 46 | + |
| 47 | + ```bash |
| 48 | + git clone https://github.com/KiritoKing/notion-astro-rev.git |
| 49 | + cd notion-astro-rev |
| 50 | + ``` |
| 51 | + |
| 52 | +2. Install dependencies: |
| 53 | + |
| 54 | + ```bash |
| 55 | + pnpm install |
| 56 | + pnpm add sharp |
| 57 | + ``` |
| 58 | + |
| 59 | +3. Create a `.env` file in the root directory with your Notion credentials: |
| 60 | + |
| 61 | + ```env |
| 62 | + NOTION_TOKEN=your_notion_integration_token |
| 63 | + NOTION_DATABASE_ID=your_notion_database_id |
| 64 | + ``` |
| 65 | + |
| 66 | +4. Start the development server: |
| 67 | + |
| 68 | + ```bash |
| 69 | + pnpm dev |
| 70 | + ``` |
| 71 | + |
| 72 | +5. Open your browser and navigate to `http://localhost:4321` |
| 73 | + |
| 74 | +### Tech Stack |
| 75 | + |
| 76 | +- **[Astro](https://astro.build)**: Fast, modern static site generator |
| 77 | +- **[Tailwind CSS](https://tailwindcss.com)**: Utility-first CSS framework |
| 78 | +- **[Svelte](https://svelte.dev)**: Component framework for interactive elements |
| 79 | +- **[notion-astro-loader](https://github.com/KiritoKing/notion-astro-loader)**: Notion integration for Astro |
| 80 | +- **[Playwright](https://playwright.dev)**: End-to-end testing framework |
| 81 | +- **[TypeScript](https://www.typescriptlang.org/)**: Type-safe JavaScript |
| 82 | + |
| 83 | +## 🛠️ Customization |
| 84 | + |
| 85 | +### Configuration |
| 86 | + |
| 87 | +The main configuration files are located in the `src` directory: |
| 88 | + |
| 89 | +- `config.ts`: General site configuration (title, theme, navigation, etc.) |
| 90 | +- `content.config.ts`: Notion integration configuration |
| 91 | + |
| 92 | +### Notion Database Setup |
| 93 | + |
| 94 | +Your Notion database should include the following properties for optimal compatibility: |
| 95 | + |
| 96 | +- `title` (Title): The title of your post |
| 97 | +- `date` (Date): Publication date |
| 98 | +- `status` (Select): Publication status (e.g., "Published", "Draft") |
| 99 | +- `tags` (Multi-select): Post tags |
| 100 | +- `category` (Select): Post category |
| 101 | +- `description` (Text): Brief description for SEO and previews |
| 102 | +- `image` (URL or Files & Media): Cover image |
| 103 | + |
| 104 | +### Theme Customization |
| 105 | + |
| 106 | +Edit the `src/config.ts` file to customize: |
| 107 | + |
| 108 | +- Site title and subtitle |
| 109 | +- Theme colors and appearance |
| 110 | +- Navigation links |
| 111 | +- Profile information |
| 112 | +- Banner images |
| 113 | +- License information |
| 114 | + |
| 115 | +## 🚀 Advanced Features |
| 116 | + |
| 117 | +### URL Migration |
| 118 | + |
| 119 | +This template includes tools for migrating from other blog platforms by setting up URL redirects. The migration system works as follows: |
| 120 | + |
| 121 | +1. Define your URL mappings in `migration/url-map.json` |
| 122 | +2. The format is `{"new-url": ["old-url-1", "old-url-2", ...]}` |
| 123 | +3. The system automatically creates redirects from all old URLs to the new URL |
| 124 | +4. E2E tests in `tests/e2e/url-redirects.spec.ts` verify that redirects work correctly |
| 125 | + |
| 126 | +Example URL mapping: |
| 127 | + |
| 128 | +```json |
| 129 | +{ |
| 130 | + "my-new-post": ["2023/01/01/old-post", "post/category/old-post", "/old-post", "/blog/old-post"] |
| 131 | +} |
| 132 | +``` |
| 133 | + |
| 134 | +### Testing |
| 135 | + |
| 136 | +The project includes Playwright tests to verify URL redirects and other functionality: |
| 137 | + |
| 138 | +```bash |
| 139 | +pnpm test:e2e |
50 | 140 | ``` |
51 | 141 |
|
52 | 142 | ## 🧞 Commands |
53 | 143 |
|
54 | | -All commands are run from the root of the project, from a terminal: |
| 144 | +All commands are run from the root of the project: |
55 | 145 |
|
56 | 146 | | Command | Action | |
57 | | -|:------------------------------------|:-------------------------------------------------| |
| 147 | +| :---------------------------------- | :----------------------------------------------- | |
58 | 148 | | `pnpm install` AND `pnpm add sharp` | Installs dependencies | |
59 | 149 | | `pnpm dev` | Starts local dev server at `localhost:4321` | |
60 | 150 | | `pnpm build` | Build your production site to `./dist/` | |
61 | 151 | | `pnpm preview` | Preview your build locally, before deploying | |
62 | | -| `pnpm new-post <filename>` | Create a new post | |
| 152 | +| `pnpm test:e2e` | Run Playwright E2E tests | |
| 153 | +| `pnpm lint` | Run ESLint to check code quality | |
| 154 | +| `pnpm format` | Format code with Prettier | |
63 | 155 | | `pnpm astro ...` | Run CLI commands like `astro add`, `astro check` | |
64 | 156 | | `pnpm astro --help` | Get help using the Astro CLI | |
0 commit comments