1. 配置Gitee

1.1 配置图床

1、使用 typora 编辑博客,上传文件时,将图片上传到 gitee 的一个仓库里。
2、下载 PicGo 作为图床工具,网上下载最新稳定版,并安装 Gitee 插件。
3、从 gitee 个人页面设置中创建新 token 填到该页面汇总。
4、PicGo 进行如下配置。

搭建个人博客 - 图1

1.2 配置秘钥

1、需要在本地配置 SSH:ssh-keygen -t rsa -C "2711845964@qq.com",此处邮箱为码云注册邮箱。
2、然后在 C:\Users\yxw\.ssh 目录下的 id_rsa.pub 文件中复制粘贴出公钥。
搭建个人博客 - 图2

3、在码云中配置公钥,名称随便取。
image.png
4、输入 ssh -T git@gitee.com,查看公钥是否配置成功。
搭建个人博客 - 图4
5、同理,在 GitHub 上配置公钥。

2. Hugo

2.1 简介

Hugo 是最受欢迎的开源静态站点生成器之一。凭借其惊人的速度和灵活性,Hugo 使构建网站再次变得有趣。相比 Hexo,Hugo 响应速度更快,但是插件、主体等乜有 Hexo 丰富。

2.2 安装Hugo

1、去 Hugo releases页面 下载 hugo_xxx_Windows-64bit.zip 将它解压到一个安全的目录。
2、然后把这个目录添加到环境变量 PATH 中,重启终端。
3、运行hugo version,正确展示了版本号就说明安装成功。
搭建个人博客 - 图5

2.3 搭建本地博客

  1. # 1、创建一个新的项目。(这里尽量在Linux环境下操作,Windows下可能会存在问题)
  2. hugo new site myBlog
  3. cd myBlog
  4. # 2、添加一个主题,并在 _config.toml 下指定主题目录。
  5. git init
  6. git clone https://github.com/vaga/hugo-theme-m10c.git themes/m10c
  7. # vi _config.toml
  8. theme = 'm10c'
  9. # 3、创建一篇新的博客。
  10. hugo new post/helloworld.md
  11. # 4、开启 Hugo Serve,用于本地预览。
  12. hugo server -D

2.4 搭建远程博客

2.5 主题推荐

deploy: type: git repo: git@gitee.com:wuduyouou666/blog.git branch: master

  1. 4、本地启动博客 `hexo c && hexo g && hexo s`,浏览器访问:http://localhost:4000。<br />5、把博客推送到码云或者 GitHub 上,需要安装自动化部署工具 `npm install hexo-deployer-git --save`,然后输入` hexo c && hexo g && hexo d` 推送博客。
  2. <a name="zvXV4"></a>
  3. # 4. Docsify
  4. <a name="FX417"></a>
  5. ## 4.1 安装Docsify
  6. docsify同样是一个很好用的知识文档网站生成框架,轻量简便,而且无需构建,写完内容就可以直接发布,界面干净又卫生。工具地址:https://docsify.js.org/<br />1、安装docsify工具。
  7. ```shell
  8. npm install -g docsify-cli
  9. # 查看版本
  10. docsify -v

2、新建项目文件夹 blog repository,执行命令docsify init初始化网站。
3、启动本地预览:docsify serve

4.2 页面和URL路径

如果需要创建多个页面,或者需要多级路由的网站,在docsify里能很容易实现。打比方说,你的目录结构如下:

  1. .
  2. └── repository
  3. ├── README.md
  4. ├── test.md
  5. └── content
  6. ├── README.md
  7. └── bigdata.md

那么对应的页面访问URL地址将是:

  1. repository/README.md => http://domain.com
  2. repository/test.md => http://domain.com/test
  3. repository/content/README.md => http://domain.com/content/
  4. repository/content/bigdata.md => http://domain.com/content/bigdata

4.3 修改主题

docsify提供了多套主题可供使用。直接修改index.html中引入的CSS文件即可修改网站主题。
搭建个人博客 - 图6
目前提供有好几套主题可供选择:

  1. <link rel="stylesheet" href="//cdn.jsdelivr.net/npm/docsify/themes/vue.css">
  2. <link rel="stylesheet" href="//cdn.jsdelivr.net/npm/docsify/themes/buble.css">
  3. <link rel="stylesheet" href="//cdn.jsdelivr.net/npm/docsify/themes/dark.css">
  4. <link rel="stylesheet" href="//cdn.jsdelivr.net/npm/docsify/themes/pure.css">
  5. <link rel="stylesheet" href="//cdn.jsdelivr.net/npm/docsify/themes/dolphin.css">

5. Halo

https://halo.run/#quickstart