GithubHelp home page GithubHelp logo

next-blog-boring

一个基于notion的小博客

关于

此项目灵感来自 notion-blog-nextjs

demo

https://next-blog-boring.vercel.app/

如何使用

1. Fork 此项目

2. 修改你的个人信息

  • git clone你 fork 之后的项目,然后新建config目录,在config目录下新建配置文件 index.ts
  • 按照下面的格式修改成你的个人信息
import { AiFillGithub, AiFillMail } from 'react-icons/ai'; // import react icons
import avatarJpg from '@/public/avatar.jpg';

export const config: IConfig = {
  name: 'john',
  avatar: avatarJpg,
  contact: [
    {
      icon: AiFillGithub,
      url: 'https://www.github.com/dewjohn'
    },
    {
      icon: AiFillMail,
      url: 'mailto:[email protected]'
    }
  ],
  navList: [
    {
      title: 'Archives',
      url: '/archives'
    },
    {
      title: '显示的名称',  // 同时记得在 pages/ 目录下创建 链接.mdx 文件
      url: '/链接'
    }
  ],
  emoji: [
  '😜',
  '🤤',
  '🤪',
  '😳',
  '😍',
  '❤️',
  '🤭',
  '🥰',
  '😵‍💫',
  '😇',
  '😓',
  '🤣'
] // 单击主页空白区域随机弹出emoji表情,若数组留空,则不显示
};

  • 注意

    项目用了 react icons, 所以当你使用了 icon ,记得像示例一样在顶部导入

    如果你想要自定义页面,并能通过点击博客顶部的导航条进入该页面,则需要做以下工作:

    1. config/index.ts 配置文件中,仿照 navList 写上你的导航项目,如:
      {
        title: 'About',
        url: '/about'
      },
    
    1. pages/ 目录下创建相应文件.mdx,比如上面创建了 About 页面,那就在 pages 目录下创建 about.mdx

    2. 接下来就可以按照 markdown 语法书写内容了

  • 完整实例

    可以查看当前仓库的 example 分支,查看如何书写config配置文件

    https://github.com/dewjohn/next-blog-boring/tree/example

  • 更新完你的个人信息后推送到你的仓库

    git push origin main
    

3. 找到 notion key

创建 notion 数据库,复刻(右上角Duplicate) notion database table 到你的 notion 账号中,然后点击项目右上角的share,把Share to web打开

打开https://www.notion.com/my-integrations,创建一个integration,创建好就能获取NOTION_TOKEN,如图: https://files.readme.io/cbbd7c3-create_integration.gif

NOTION_DATABASE_ID就是你的项目链接上的一串字符 https://files.readme.io/62e5027-notion_database_id.png

更详细教程可以查看 getting started guide 找到NOTION_TOKENNOTION_DATABASE_ID

4. 部署到 vercel

点击 vercel 此链接,选择刚才 fork 到你仓库的项目,然后在 导入项目页面 Environment Variables 中填入刚获取的 NOTION_TOKENNOTION_DATABASE_ID 即可成功部署

NOTION_TOKEN=
NOTION_DATABASE_ID=

5. 写作

至此,在 notion 中写作,即可在博客看到刚在notion写的笔记,无需重新部署项目🤗

6. 关于无缝更新

先设置远程仓库

git remote add upstream [email protected]:dewjohn/next-blog-boring.git

只要执行

git pull upstream main

即可更新到最新分支

然后再执行,推送到你的仓库

git push origin main

推送完毕,vercel自动重新构建,完成丝滑更新

7. 本地开发

安装 pnpm

npm install -g pnpm

安装项目所需依赖

pnpm i

添加本地环境变量 NOTION_TOKENNOTION_DATABASE_ID

在项目根目录新建 .env 文件

NOTION_TOKEN = 你的NOTION_TOKEN
NOTION_DATABASE_ID = 你的NOTION_DATABASE_ID

启动开发

pnpm dev

to do

  • 增加SEO
  • 增加代码块highlight.js高亮
  • 等等改进

License

MIT

enc1ose's Projects

fhs-install-v2ray icon fhs-install-v2ray

Bash script for installing V2Ray in operating systems such as Debian / CentOS / Fedora / openSUSE that support systemd

freenom icon freenom

Freenom域名自动续期。Freenom domain name renews automatically.

notionnext icon notionnext

使用 NextJS + Notion API 实现的,支持多种部署方案的静态博客,无需服务器、零门槛搭建网站,为Notion和所有创作者设计。 (A static blog built with NextJS and Notion API, supporting multiple deployment options. No server required, zero threshold to set up a website. Designed for Notion and all creators.)

onemanager-php icon onemanager-php

An index & manager of Onedrive based on serverless. Can be deployed to Heroku/Glitch/Vercel/Replit/SCF/FG/FC/CFC/PHP web hosting/VPS.

scripts icon scripts

京东薅羊毛工具, 京东水果、宠物、种豆等等

telegraph-image icon telegraph-image

Free Image Hosting solution, Flickr/imgur alternative. Using Cloudflare Pages and Telegraph.

v2ray-agent icon v2ray-agent

(VLESS+TCP+TLS/VLESS+TCP+XTLS/VLESS+gRPC+TLS/VLESS+WS+TLS/VMess+TCP+TLS/VMess+WS+TLS/Trojan+TCP+TLS/Trojan+gRPC+TLS/Trojan+TCP+XTLS)+伪装站点、八合一共存脚本,支持多内核安装

vmess icon vmess

用于在 Heroku 上部署 V2Ray WebSocket。

xray_onekey icon xray_onekey

Xray 基于 Nginx 的 VLESS + XTLS 一键安装脚本

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.