Publish a Website with Material for MkDocs and GitHub Pages

For example:Mkdocs静态网站制作

详细文档:MkDocs

CSDN教程:

1.利用mkdocs部署静态网页至GitHub pages

2.Mkdocs部署静态网页至GitHub pages配置说明


MkDocs 的材料是 MkDocs 的主题,MkDocs 是一个面向(技术)项目文档的静态站点生成器。如果你熟悉 Python,你可以使用pip(Python 包管理器)安装 Material for MkDocs。如果没有,我们建议使用docker。

创建一个文件

$ mkdocs new mkdocs-site
INFO     -  Creating project directory: mkdocs-site
INFO     -  Writing config file: mkdocs-site/mkdocs.yml
INFO     -  Writing initial docs: mkdocs-site/docs/index.md
$ cd mkdocs-site

目录结构

$ tree -a
.
├── docs
│   └── index.md
└── mkdocs.yml

Add GitHub Workflow

$ mkdir .github
$ cd .github
$ mkdir workflows
$ cd workflows
$ vim PublishMySite.yml
$ tree -a
.
├── .github
│   ├── .DS_Store
│   └── workflows
│       └── PublishMySite.yml
├── docs
│   └── index.md
└── mkdocs.yml

Git and GitHub

git init

$ git init
$ git add .
$ git commit -m "init"

GitHub - New Repository

GitHub > New Repository

GitHub > Repository > Settings > Actions > General >

  • Actions permissions: Allow all actions and reusable workflows

  • Workflow permissions: Read and write permissions

  • Click Save

$ git remote add origin [email protected]:Wcowin/Wowin.github.io.git # change to your github repo
$ git branch -M main
$ git push -u origin main

GitHub > Repository > Settings > Pages > Source > gh-pages > Click Save

建议下载Github Desktop然后克隆到本地仓库,这样以后pull和push的同步也会方便(个人见解:可能需要科学上网不然速度很慢) 操作详见:这个视频

也可以学习一下git:https://www.runoob.com/git/git-tutorial.html

实现自定义域名访问

实现自定义域名访问


你可能感兴趣的:(github,css)