Skip to content

Commit 547871d

Browse files
Initial commit
0 parents  commit 547871d

File tree

89 files changed

+14844
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

89 files changed

+14844
-0
lines changed

.gitignore

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# build output
2+
dist/
3+
4+
# generated types
5+
.astro/
6+
7+
# dependencies
8+
node_modules/
9+
10+
# logs
11+
npm-debug.log*
12+
yarn-debug.log*
13+
yarn-error.log*
14+
pnpm-debug.log*
15+
16+
# environment variables
17+
.env
18+
.env.production
19+
20+
# macOS-specific files
21+
.DS_Store
22+
23+
.vercel

.vscode/extensions.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"recommendations": ["biomejs.biome", "astro-build.astro-vscode"]
3+
}

.vscode/settings.json

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"editor.formatOnSave": true,
3+
"editor.defaultFormatter": "biomejs.biome",
4+
"[javascript]": {
5+
"editor.defaultFormatter": "biomejs.biome"
6+
},
7+
"[javascriptreact]": {
8+
"editor.defaultFormatter": "biomejs.biome"
9+
},
10+
"[typescript]": {
11+
"editor.defaultFormatter": "biomejs.biome"
12+
},
13+
"[typescriptreact]": {
14+
"editor.defaultFormatter": "biomejs.biome"
15+
},
16+
"editor.codeActionsOnSave": {
17+
"source.fixAll": "explicit",
18+
"quickfix.biome": "always",
19+
"source.organizeImports.biome": "always"
20+
},
21+
"frontMatter.dashboard.openOnStart": false
22+
}

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2024 saicaca
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.ja-JP.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# 🍥Fuwari
2+
3+
[Astro](https://astro.build)で構築された静的ブログテンプレート
4+
5+
[**🖥️ライブデモ (Vercel)**](https://fuwari.vercel.app)   /   [**🌏中文**](https://github.com/saicaca/fuwari/blob/main/README.zh-CN.md)   /   [**🌏日本語**](https://github.com/saicaca/fuwari/blob/main/README.ja-JP.md)   /   [**📦旧Hexoバージョン**](https://github.com/saicaca/hexo-theme-vivia)
6+
7+
![Preview Image](https://raw.githubusercontent.com/saicaca/resource/main/fuwari/home.png)
8+
9+
## ✨ 特徴
10+
11+
- [x] [Astro](https://astro.build)及び [Tailwind CSS](https://tailwindcss.com)で構築
12+
- [x] スムーズなアニメーションとページ遷移
13+
- [x] ライト/ダークテーマ対応
14+
- [x] カスタマイズ可能なテーマカラーとバナー
15+
- [x] レスポンシブデザイン
16+
- [ ] コメント機能
17+
- [x] 検索機能
18+
- [ ] 目次
19+
20+
## 🚀 使用方法
21+
22+
1. [テンプレート](https://github.com/saicaca/fuwari/generate)から新しいリポジトリを作成するかCloneをします。
23+
2. ブログをローカルで編集するには、リポジトリをクローンした後、`pnpm install``pnpm add sharp` を実行して依存関係をインストールします。
24+
- [pnpm](https://pnpm.io)がインストールされていない場合は `npm install -g pnpm` で導入可能です。
25+
3. `src/config.ts`ファイルを編集する事でブログを自分好みにカスタマイズ出来ます。
26+
4. `pnpm new-post <filename>`で新しい記事を作成し、`src/content/posts/`.フォルダ内で編集します。
27+
5. 作成したブログをVercel、Netlify、GitHub Pagesなどにデプロイするには[ガイド](https://docs.astro.build/ja/guides/deploy/)に従って下さい。加えて、別途デプロイを行う前に`astro.config.mjs`を編集してサイト構成を変更する必要があります。
28+
29+
## ⚙️ 記事のフロントマター
30+
31+
```yaml
32+
---
33+
title: My First Blog Post
34+
published: 2023-09-09
35+
description: This is the first post of my new Astro blog.
36+
image: /images/cover.jpg
37+
tags: [Foo, Bar]
38+
category: Front-end
39+
draft: false
40+
---
41+
```
42+
43+
## 🧞 コマンド
44+
45+
すべてのコマンドは、ターミナルでプロジェクトのルートから実行する必要があります:
46+
47+
| Command | Action |
48+
|:------------------------------------|:-------------------------------------------------|
49+
| `pnpm install` AND `pnpm add sharp` | 依存関係のインストール |
50+
| `pnpm dev` | `localhost:4321`で開発用ローカルサーバーを起動 |
51+
| `pnpm build` | `./dist/`にビルド内容を出力 |
52+
| `pnpm preview` | デプロイ前の内容をローカルでプレビュー |
53+
| `pnpm new-post <filename>` | 新しい投稿を作成 |
54+
| `pnpm astro ...` | `astro add`, `astro check`の様なコマンドを実行する際に使用 |
55+
| `pnpm astro --help` | Astro CLIのヘルプを表示 |

README.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# 🍥Fuwari
2+
3+
A static blog template built with [Astro](https://astro.build).
4+
5+
[**🖥️Live Demo (Vercel)**](https://fuwari.vercel.app)&nbsp;&nbsp;&nbsp;/&nbsp;&nbsp;&nbsp;[**🌏中文 README**](https://github.com/saicaca/fuwari/blob/main/README.zh-CN.md)&nbsp;&nbsp;&nbsp;/&nbsp;&nbsp;&nbsp;[**🌏日本語 README**](https://github.com/saicaca/fuwari/blob/main/README.ja-JP.md)&nbsp;&nbsp;&nbsp;/&nbsp;&nbsp;&nbsp;[**📦Old Hexo Version**](https://github.com/saicaca/hexo-theme-vivia)
6+
7+
![Preview Image](https://raw.githubusercontent.com/saicaca/resource/main/fuwari/home.png)
8+
9+
## ✨ Features
10+
11+
- [x] Built with [Astro](https://astro.build) and [Tailwind CSS](https://tailwindcss.com)
12+
- [x] Smooth animations and page transitions
13+
- [x] Light / dark mode
14+
- [x] Customizable theme colors & banner
15+
- [x] Responsive design
16+
- [ ] Comments
17+
- [x] Search
18+
- [ ] TOC
19+
20+
## 🚀 How to Use
21+
22+
1. [Generate a new repository](https://github.com/saicaca/fuwari/generate) from this template or fork this repository.
23+
2. To edit your blog locally, clone your repository, run `pnpm install` AND `pnpm add sharp` to install dependencies.
24+
- Install [pnpm](https://pnpm.io) `npm install -g pnpm` if you haven't.
25+
3. Edit the config file `src/config.ts` to customize your blog.
26+
4. Run `pnpm new-post <filename>` to create a new post and edit it in `src/content/posts/`.
27+
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.
28+
29+
## ⚙️ Frontmatter of Posts
30+
31+
```yaml
32+
---
33+
title: My First Blog Post
34+
published: 2023-09-09
35+
description: This is the first post of my new Astro blog.
36+
image: /images/cover.jpg
37+
tags: [Foo, Bar]
38+
category: Front-end
39+
draft: false
40+
---
41+
```
42+
43+
## 🧞 Commands
44+
45+
All commands are run from the root of the project, from a terminal:
46+
47+
| Command | Action |
48+
|:------------------------------------|:-------------------------------------------------|
49+
| `pnpm install` AND `pnpm add sharp` | Installs dependencies |
50+
| `pnpm dev` | Starts local dev server at `localhost:4321` |
51+
| `pnpm build` | Build your production site to `./dist/` |
52+
| `pnpm preview` | Preview your build locally, before deploying |
53+
| `pnpm new-post <filename>` | Create a new post |
54+
| `pnpm astro ...` | Run CLI commands like `astro add`, `astro check` |
55+
| `pnpm astro --help` | Get help using the Astro CLI |

README.zh-CN.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# 🍥Fuwari
2+
3+
基于 [Astro](https://astro.build) 开发的静态博客模板。
4+
5+
[**🖥️在线预览(Vercel)**](https://fuwari.vercel.app)&nbsp;&nbsp;&nbsp;/&nbsp;&nbsp;&nbsp;[**🌏English README**](https://github.com/saicaca/fuwari)&nbsp;&nbsp;&nbsp;/&nbsp;&nbsp;&nbsp;[**🌏日本語 README**](https://github.com/saicaca/fuwari/blob/main/README.ja-JP.md)&nbsp;&nbsp;&nbsp;/&nbsp;&nbsp;&nbsp;[**📦旧 Hexo 版本**](https://github.com/saicaca/hexo-theme-vivia)
6+
7+
![Preview Image](https://raw.githubusercontent.com/saicaca/resource/main/fuwari/home.png)
8+
9+
## ✨ 功能特性
10+
11+
- [x] 基于 Astro 和 Tailwind CSS 开发
12+
- [x] 流畅的动画和页面过渡
13+
- [x] 亮色 / 暗色模式
14+
- [x] 自定义主题色和横幅图片
15+
- [x] 响应式设计
16+
- [ ] 评论
17+
- [x] 搜索
18+
- [ ] 文内目录
19+
20+
## 🚀 使用方法
21+
22+
1. 使用此模板[生成新仓库](https://github.com/saicaca/fuwari/generate)或 Fork 此仓库
23+
2. 进行本地开发,Clone 新的仓库,执行 `pnpm install``pnpm add sharp` 以安装依赖
24+
- 若未安装 [pnpm](https://pnpm.io),执行 `npm install -g pnpm`
25+
3. 通过配置文件 `src/config.ts` 自定义博客
26+
4. 执行 `pnpm new-post <filename>` 创建新文章,并在 `src/content/posts/` 目录中编辑
27+
5. 参考[官方指南](https://docs.astro.build/zh-cn/guides/deploy/)将博客部署至 Vercel, Netlify, GitHub Pages 等;部署前需编辑 `astro.config.mjs` 中的站点设置。
28+
29+
## ⚙️ 文章 Frontmatter
30+
31+
```yaml
32+
---
33+
title: My First Blog Post
34+
published: 2023-09-09
35+
description: This is the first post of my new Astro blog.
36+
image: /images/cover.jpg
37+
tags: [Foo, Bar]
38+
category: Front-end
39+
draft: false
40+
---
41+
```
42+
43+
## 🧞 指令
44+
45+
下列指令均需要在项目根目录执行:
46+
47+
| Command | Action |
48+
|:----------------------------------|:----------------------------------|
49+
| `pnpm install``pnpm add sharp` | 安装依赖 |
50+
| `pnpm dev` |`localhost:4321` 启动本地开发服务器 |
51+
| `pnpm build` | 构建网站至 `./dist/` |
52+
| `pnpm preview` | 本地预览已构建的网站 |
53+
| `pnpm new-post <filename>` | 创建新文章 |
54+
| `pnpm astro ...` | 执行 `astro add`, `astro check` 等指令 |
55+
| `pnpm astro --help` | 显示 Astro CLI 帮助 |

astro.config.mjs

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
import tailwind from "@astrojs/tailwind"
2+
import Compress from "astro-compress"
3+
import icon from "astro-icon"
4+
import { defineConfig } from "astro/config"
5+
import Color from "colorjs.io"
6+
import rehypeAutolinkHeadings from "rehype-autolink-headings"
7+
import rehypeKatex from "rehype-katex"
8+
import rehypeSlug from "rehype-slug"
9+
import remarkMath from "remark-math"
10+
import { remarkReadingTime } from "./src/plugins/remark-reading-time.mjs"
11+
import { GithubCardComponent } from "./src/plugins/rehype-component-github-card.mjs"
12+
import { AdmonitionComponent } from "./src/plugins/rehype-component-admonition.mjs"
13+
import remarkDirective from "remark-directive" /* Handle directives */
14+
import remarkGithubAdmonitionsToDirectives from "remark-github-admonitions-to-directives";
15+
import rehypeComponents from "rehype-components"; /* Render the custom directive content */
16+
import svelte from "@astrojs/svelte"
17+
import swup from '@swup/astro';
18+
import sitemap from '@astrojs/sitemap';
19+
import {parseDirectiveNode} from "./src/plugins/remark-directive-rehype.js";
20+
21+
const oklchToHex = (str) => {
22+
const DEFAULT_HUE = 250
23+
const regex = /-?\d+(\.\d+)?/g
24+
const matches = str.string.match(regex)
25+
const lch = [matches[0], matches[1], DEFAULT_HUE]
26+
return new Color("oklch", lch).to("srgb").toString({
27+
format: "hex",
28+
})
29+
}
30+
31+
// https://astro.build/config
32+
export default defineConfig({
33+
site: "https://fuwari.vercel.app/",
34+
base: "/",
35+
trailingSlash: "always",
36+
integrations: [
37+
tailwind(),
38+
swup({
39+
theme: false,
40+
animationClass: 'transition-',
41+
containers: ['main'],
42+
smoothScrolling: true,
43+
cache: true,
44+
preload: true,
45+
accessibility: true,
46+
globalInstance: true,
47+
}),
48+
icon({
49+
include: {
50+
"material-symbols": ["*"],
51+
"fa6-brands": ["*"],
52+
"fa6-regular": ["*"],
53+
"fa6-solid": ["*"],
54+
},
55+
}),
56+
Compress({
57+
Image: false,
58+
}),
59+
svelte(),
60+
sitemap(),
61+
],
62+
markdown: {
63+
remarkPlugins: [remarkMath, remarkReadingTime, remarkGithubAdmonitionsToDirectives, remarkDirective, parseDirectiveNode],
64+
rehypePlugins: [
65+
rehypeKatex,
66+
rehypeSlug,
67+
[rehypeComponents, {
68+
components: {
69+
github: GithubCardComponent,
70+
note: (x, y) => AdmonitionComponent(x, y, "note"),
71+
tip: (x, y) => AdmonitionComponent(x, y, "tip"),
72+
important: (x, y) => AdmonitionComponent(x, y, "important"),
73+
caution: (x, y) => AdmonitionComponent(x, y, "caution"),
74+
warning: (x, y) => AdmonitionComponent(x, y, "warning"),
75+
},
76+
}],
77+
[
78+
rehypeAutolinkHeadings,
79+
{
80+
behavior: "append",
81+
properties: {
82+
className: ["anchor"],
83+
},
84+
content: {
85+
type: "element",
86+
tagName: "span",
87+
properties: {
88+
className: ["anchor-icon"],
89+
'data-pagefind-ignore': true,
90+
},
91+
children: [
92+
{
93+
type: "text",
94+
value: "#",
95+
},
96+
],
97+
},
98+
},
99+
],
100+
],
101+
},
102+
vite: {
103+
build: {
104+
rollupOptions: {
105+
onwarn(warning, warn) {
106+
// temporarily suppress this warning
107+
if (warning.message.includes("is dynamically imported by") && warning.message.includes("but also statically imported by")) {
108+
return;
109+
}
110+
warn(warning);
111+
}
112+
}
113+
},
114+
css: {
115+
preprocessorOptions: {
116+
stylus: {
117+
define: {
118+
oklchToHex: oklchToHex,
119+
},
120+
},
121+
},
122+
},
123+
},
124+
})

0 commit comments

Comments
 (0)