Skip to content

Commit

Permalink
chore: 配置博客
Browse files Browse the repository at this point in the history
  • Loading branch information
robinv8 committed Jan 1, 2024
1 parent 6b4207f commit 71c7912
Show file tree
Hide file tree
Showing 13 changed files with 2,379 additions and 755 deletions.
3 changes: 0 additions & 3 deletions .env.example

This file was deleted.

2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2021-present, Zuo Lan
Copyright (c) 2021-present, Robin

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
61 changes: 1 addition & 60 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,60 +1 @@
# Notionic

Notionic is a static blog that updates in real time, synchronizing changes to Notion pages without rebuilding the deployment.

![Notionic](./banner.png)

## Demo

- Notionic: [https://notionic.vercel.app](https://notionic.vercel.app)
- My Blog: [https://zuolan.me](https://zuolan.me)

## Features

- Incremental static regeneration
- Outline
- Theme switch
- Multi-language
- Native style comments
- Loading and transition animation
- Block page support
- SEO and Open Graph optimization
- Newsletter support
- Contact Form
- Telegram bot integration

## Quick Start

- Duplicate [Notionic template](https://zuolan.notion.site/dea4de63b4aa4efb87174591936f0bde), and share it to the public
- [Fork](https://github.com/izuolan/notionic/fork) this project
- **Customize `blog.config.js` file**
- _(Optional)_ Replace `favicon.svg/png/ico` in `public` folder with your own
- Modify `lib/lang.js` with your self introduction
- Deploy on [Vercel](https://vercel.com), set following environment variables:
- `NOTION_PAGE_ID` (Required): The ID of the Notion page you previously shared to the web, usually has 32 digits after your workspace address
- eg: `https://your-username.notion.site/<NOTION_PAGE_ID>?v=<view_id>`

More details about Notionic deployment:

- [English](https://zuolan.me/en/notionic_en)
- [中文](https://zuolan.me/notionic)

## Development

```bash
# Init
pnpm install
# Develop
./dev.sh
# Build & Serve
pnpm build
pnpm start
```

## Reference & License

- [Notion-X](https://github.com/NotionX/react-notion-x)
- [Nobelium](https://github.com/craigary/nobelium)
- [NotionNext](https://github.com/tangly1024/NotionNext)

The MIT License.
# 我的博客
36 changes: 18 additions & 18 deletions blog.config.js
Original file line number Diff line number Diff line change
@@ -1,51 +1,51 @@
const BLOG = {
title: 'Notionic',
author: '左蓝',
email: 'i@zuolan.me',
link: 'https://zuolan.me',
newsletter: 'Notionic Weekly',
title: 'robin blog',
author: 'robin',
email: 'robin@rnode.me',
link: 'https://blog.robin.me',
newsletter: 'Weekly',
description: 'A static blog build on top of Notion and Next.js',
lang: 'en-US', // ['en-US', 'zh-CN', 'zh-HK', 'zh-TW', 'ja-JP', 'es-ES']
lang: 'zh-CN', // ['en-US', 'zh-CN', 'zh-HK', 'zh-TW', 'ja-JP', 'es-ES']
timezone: 'Asia/Shanghai', // See https://en.wikipedia.org/wiki/List_of_tz_database_time_zones for all options.
appearance: 'auto', // ['light', 'dark', 'auto'],
font: 'sans-serif', // ['sans-serif', 'serif']
lightBackground: '#F6F8FA', // use hex value, don't forget '#' e.g #fffefc
darkBackground: '#212936', // use hex value, don't forget '#'
path: '', // leave this empty unless you want to deploy Notionic in a folder
since: 2022, // If leave this empty, current year will be used.
since: 2018, // If leave this empty, current year will be used.
postsPerPage: 10,
sortByDate: true,
pagesShow: {
newsletter: true,
notes: true,
notes:false,
projects: true,
contact: true,
books: true,
friends: true
},
showWeChatPay: true,
showWeChatPay: false,
previewImagesEnabled: true,
autoCollapsedNavBar: false, // The automatically collapsed navigation bar
ogImageGenerateHost: 'og-zl.vercel.app', // The link to generate OG image, don't end with a slash
defaultCover: '/cover.jpg',
socialLink: {
twitter: 'https://twitter.com/izuolan',
github: 'https://github.com/izuolan',
telegram: 'https://t.me/zuolan'
twitter: 'https://twitter.com/robin__0716',
github: 'https://github.com/robinv8',
telegram: 'https://t.me/robin_0716'
},
seo: {
keywords: ['Notionic', 'Zuolan', 'Blog'],
keywords: ['robin', 'Blog'],
googleSiteVerification: '' // Remove the value or replace it with your own google site verification code
},
notionPageId: process.env.NOTION_PAGE_ID, // DO NOT CHANGE THIS! Edit .env file!
notionSpacesId: process.env.NOTION_SPACES_ID, // DO NOT CHANGE THIS! Edit .env file!
notionAccessToken: process.env.NOTION_ACCESS_TOKEN, // Useful if you prefer not to make your database public
notionDomain: 'izuolan.notion.site',
notionDomain: process.env.NOTION_DOMAIN,
telegramToken: process.env.TELEGRAM_TOKEN, // The token of your Telegram bot
telegramChatId: '263895784', // The chat id of your Telegram bot
telegramChannelUrl: 'https://channel.zuolan.me/', // The link of your Telegram channel
telegramChannelName: 'zuolan_me', // The name of your Telegram channel
craftConfigShareUrl: 'https://www.craft.do/s/kQtcWqkv98cHhB', // The link to share your craft config
telegramChatId: process.env.TELEGRAM_CHAT_ID, // The chat id of your Telegram bot
telegramChannelUrl: '', // The link of your Telegram channel
telegramChannelName: '', // The name of your Telegram channel
craftConfigShareUrl: process.env.CRAFT_CONFIG_SHARE_URL, // The link to share your craft config
analytics: {
provider: '', // Currently we support Google Analytics, Ackee, Umami and Cloudflare Insights, please fill with 'ga' or 'ackee' or 'umami' or 'cf', leave it empty to disable it.
ackeeConfig: {
Expand Down
23 changes: 10 additions & 13 deletions components/Common/Logo.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,19 @@
// https://react-svgr.com/playground/
import * as React from 'react'
import Image from 'next/image'
import svg from '@/public/favicon.svg'

const Logo = (props) => (
<svg
xmlns='http://www.w3.org/2000/svg'
width='24'
height='24'
viewBox='0 0 100 100'
<Image
{...props}
src={svg}
style={{
opacity: 1
height: '3rem',
width: '3rem',
borderRadius: '50%'
}}
{...props}
>
<g transform='translate(0.000000,100) scale(0.080000,-0.080000)'>
<path d='M762 1203 c-6 -15 -13 -46 -17 -68 -4 -22 -13 -49 -20 -61 -15 -23 -122 -69 -257 -109 -49 -14 -88 -28 -88 -29 0 -2 33 -20 73 -40 49 -24 87 -36 115 -36 28 0 42 -4 42 -13 0 -34 -295 -517 -390 -639 -40 -52 -4 -28 86 56 49 46 105 109 124 141 19 31 64 98 100 148 77 108 125 186 173 283 20 39 46 78 59 86 13 8 69 34 126 58 107 45 118 57 110 111 -3 21 -10 25 -78 34 l-75 10 -5 45 c-5 42 -7 45 -36 48 -26 3 -33 -1 -42 -25z' />
<path d='M754 616 c-40 -19 -88 -39 -108 -46 -43 -14 -45 -30 -7 -72 25 -28 33 -31 80 -30 39 1 54 -3 58 -15 7 -18 -30 -140 -58 -192 -36 -67 6 -93 135 -84 l86 6 0 -26 c0 -14 -4 -37 -10 -51 -5 -14 -8 -26 -6 -26 7 0 110 68 129 85 11 10 17 30 17 60 0 62 -22 70 -150 57 -52 -5 -98 -6 -103 -2 -4 3 3 31 16 61 13 30 32 78 42 108 10 30 28 70 41 89 26 38 30 63 14 93 -17 31 -91 25 -176 -15z' />
</g>
</svg>
alt='logo'
/>
)

export default Logo
41 changes: 22 additions & 19 deletions components/Loading.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { useRouter } from 'next/router'
import { useState } from 'react'
import { ExternalLinkIcon } from '@heroicons/react/outline'
import Link from 'next/link'
import Logo from '@/components/Common/Logo'

export default function Loading({ notionSlug }) {
const { locale } = useRouter()
Expand All @@ -20,38 +21,40 @@ export default function Loading({ notionSlug }) {
<div className='py-6 sm:py-8 lg:py-12'>
<div className='max-w-screen-2xl px-4 md:px-8 mx-auto'>
<div className='flex flex-col items-center'>
<div className='inline-flex items-center gap-2.5 mb-8'>
<p className='inline-flex items-center text-sm md:text-base font-semibold uppercase mb-4'>
<svg
className='animate-spin -ml-1 mr-3 h-5 w-5 text-gray-400'
xmlns='http://www.w3.org/2000/svg'
width='24'
height='24'
viewBox='0 0 100 100'
className='h-6 hover:text-blue-500 fill-current dark:text-white'
fill='none'
viewBox='0 0 24 24'
>
<g transform='translate(0.000000,100) scale(0.080000,-0.080000)'>
<path d='M762 1203 c-6 -15 -13 -46 -17 -68 -4 -22 -13 -49 -20 -61 -15 -23 -122 -69 -257 -109 -49 -14 -88 -28 -88 -29 0 -2 33 -20 73 -40 49 -24 87 -36 115 -36 28 0 42 -4 42 -13 0 -34 -295 -517 -390 -639 -40 -52 -4 -28 86 56 49 46 105 109 124 141 19 31 64 98 100 148 77 108 125 186 173 283 20 39 46 78 59 86 13 8 69 34 126 58 107 45 118 57 110 111 -3 21 -10 25 -78 34 l-75 10 -5 45 c-5 42 -7 45 -36 48 -26 3 -33 -1 -42 -25z' />
<path d='M754 616 c-40 -19 -88 -39 -108 -46 -43 -14 -45 -30 -7 -72 25 -28 33 -31 80 -30 39 1 54 -3 58 -15 7 -18 -30 -140 -58 -192 -36 -67 6 -93 135 -84 l86 6 0 -26 c0 -14 -4 -37 -10 -51 -5 -14 -8 -26 -6 -26 7 0 110 68 129 85 11 10 17 30 17 60 0 62 -22 70 -150 57 -52 -5 -98 -6 -103 -2 -4 3 3 31 16 61 13 30 32 78 42 108 10 30 28 70 41 89 26 38 30 63 14 93 -17 31 -91 25 -176 -15z' />
</g>
</svg>
</div>

<p className='inline-flex items-center text-sm md:text-base font-semibold uppercase mb-4'>
<svg className='animate-spin -ml-1 mr-3 h-5 w-5 text-gray-400' xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24'>
<circle className='opacity-25' cx='12' cy='12' r='10' stroke='currentColor' strokeWidth='4'></circle>
<path className='opacity-75' fill='currentColor' d='M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z'></path>
<circle
className='opacity-25'
cx='12'
cy='12'
r='10'
stroke='currentColor'
strokeWidth='4'
></circle>
<path
className='opacity-75'
fill='currentColor'
d='M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z'
></path>
</svg>
{t.ERROR.LOADING}
</p>
{showNotion &&
{showNotion && (
<Link
passHref
href={`https://${BLOG.notionDomain}/${notionSlug}`} scroll={false}
href={`https://${BLOG.notionDomain}/${notionSlug}`}
scroll={false}
className='text-gray-500 hover:text-gray-600 dark:text-gray-400 dark:hover:text-gray-300 transition duration-100'
>
<ExternalLinkIcon className='inline-block mb-1 h-5 w-5' />
<span className='m-1'>{t.ERROR.TIMEOUT_TEXT}</span>
</Link>
}
)}
</div>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion lib/getBlocksMaps.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import BLOG from '@/blog.config'

// 从 Config 页面的 API 获取两个表格的内容, 并处理成两个 json 返回给 htmlrewrite.js
export async function getBlocksMaps() {
const craftConfigSecret = BLOG.craftConfigShareUrl.slice(23)
const craftConfigSecret = BLOG.craftConfigShareUrl.split('/').pop()
const craftConfigApiUrl = 'https://www.craft.do/api/share/' + craftConfigSecret
const init = {
headers: {
Expand Down
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
{
"name": "notionic",
"version": "3.0.0",
"homepage": "https://zuolan.me",
"homepage": "https://rnode.me",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/izuolan/notionic.git"
"url": "https://github.com/robinv8/blog.git"
},
"author": {
"name": "Zuo Lan",
"email": "i@zuolan.me",
"url": "https://zuolan.me"
"name": "robin",
"email": "robin@rnode.me",
"url": "https://rnode.me"
},
"scripts": {
"dev": "next dev",
Expand Down Expand Up @@ -55,7 +55,7 @@
"typescript": "^5.0.3"
},
"bugs": {
"url": "https://github.com/izuolan/notionic/issues",
"email": "i@zuolan.me"
"url": "https://github.com/robinv8/blog.git/issues",
"email": "robin@rnode.me"
}
}
8 changes: 0 additions & 8 deletions pages/api/apirewrite.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,6 @@ module.exports = async (req, res) => {
try {
const response = await fetch(url)
res.send(await response.json())

// const originResText = await response.text()
// const modifyResText = originResText
// .replace(/5A942651-8A73-49C7-9B36-0FD047A6D6EC/g, 'test-page')
// .replace(/craftdocs:\/\/open\?blockId=/g, 'https://zuolan.me/notes/page/')
// .replace(/&spaceId=48c91199-cb47-f359-8399-2a12d07b0b02/g, '')
// console.log(modifyResText.toString())
// res.send(await modifyResText.toString())
} catch (e) {
res.send(e)
}
Expand Down
Loading

0 comments on commit 71c7912

Please sign in to comment.