用mkdocs搭建github个人博客
1.安装mkdocs
pip install mkdocs 安装工具
pip install mkdocs mkdocs-material
pip install mkdocs-awesome-pages-plugin
15点24分
2.新建项目
mkdocs new 博客名字
cd 博客名字
git init
git add .
git commit -m "update"
## 3.用ssh公钥绑定github 搜索方法,这里不再赘述。
4.仓库绑定
git remote add origin https://github.com/bg6mgd/docs.git
上面不行了,用下面这个
git remote set-url origin git@github.com:bg6mgd/docs.git
git branch -M main
`git remote -v` 用来**查看当前仓库配置的远程仓库地址**。
典型输出:
origin git@github.com:user/repo.git (fetch)
origin git@github.com:user/repo.git (push)
5.编辑内容
在文件夹中找到mkdocs.yml配置文件,编辑配置内容
site_name: 我的博客
site_url: https://bg6mgd.github.io/docs/
site_description: 技术与笔记
site_author: lego
theme:
name: material
language: zh
features:
- navigation.tabs # 顶部页头标签
- navigation.sections # 左侧分组
- navigation.expand # 左侧默认展开
- navigation.top # 返回顶部
#- toc.integrate # 目录合并到左侧
palette:
- scheme: default
primary: blue
accent: blue
nav:
- 首页: index.md
- 编程: python/index.md
- 工具:
- 创建Git服务器: git/gitserver.md
- MkDocs搭建个人博客: tools/mkdocs.md
markdown_extensions:
- admonition
- toc:
permalink: true
- pymdownx.superfences
- pymdownx.highlight
- pymdownx.details
plugins:
- search
在docs文件中,创建md文件,写入内容,并在mkdocs.yml中设置关联。
6.发布
mkdocs gh-deploy
当网站有残余
mkdocs build --clean 清除残余
发布
mkdocs gh-deploy
7.实现在左边栏隐藏sitename
site_name: 我的日常记录
theme:
name: material
language: zh
features:
- navigation.sections # 左侧分组
- navigation.expand # 左侧默认展开
nav:
#- 首页: index.md
- 技术笔记:
- mkdocs实现技术博客: files/mkdocs.md
- 搭建git私有仓库: files/gitserver.md
- 搭建网站: files/website.md
plugins:
- search
##- awesome-pages # 自动生成左侧文章列表
extra_css:
- stylesheets/extra.css