# blog **Repository Path**: happyhelloworld/blog ## Basic Information - **Project Name**: blog - **Description**: Mkdocs Blog Site ! - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2023-04-10 - **Last Updated**: 2023-04-12 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README ### 主旨 - 需要搭建一套个人博客系统 - 记录技术栈的整个学习周期 ### 说明 - 目录说明 ``` 1 directory, 3 files $ tree -LN 3 . ├── README.md //主文档 ├── docs //存放截图 │   ├── about.md │   ├── door │   │   └── test-01.md │   ├── index.md │   └── test.md ├── image │   ├── mkdocs-show-01.png │   └── mkdocs-show-02.png ├── mkdocs.yml └── site ├── 404.html ├── about │   └── index.html ├── assets │   ├── images │   ├── javascripts │   └── stylesheets ├── door │   └── test-01 ├── index.html ├── search │   └── search_index.json ├── sitemap.xml ├── sitemap.xml.gz └── test └── index.html 13 directories, 15 files ``` - 环境说明 ``` 个人测试服务器环境: 192.168.1.119 /home/mkdocs/ # cat /etc/redhat-release CentOS Linux release 7.4.1708 (Core) # python3 -V Python 3.6.8 # pip3 -V pip 9.0.3 from /usr/lib/python3.6/site-packages (python 3.6) # mkdocs -V mkdocs, version 1.4.2 from /home/mkdocs/python3/lib/python3.8/site-packages/mkdocs (Python 3.8) ``` ### 任务计划 - [x] 本地搭建 - [x] 适合自己的主题 - [ ] 源码解读、安全排查 - [ ] 目录分类 - [ ] 知识积累 - [x] gitee pages配置 ### 环境搭建 - python3环境安装 ``` # 推荐官网安装,若网络下载慢可以考虑国内源 https://mirrors.huaweicloud.com/python/3.8.1/ yum install gcc patch libffi-devel python-devel zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel -y #工作目录,并将上面下载的包传到该工作目录,并执行解压 useradd mkdocs cd /home/mkdocs wget https://mirrors.huaweicloud.com/python/3.8.1/Python-3.8.1.tar.xz tar xvf Python-3.8.1.tar.xz #编译安装 cd Python-3.8.1 ./configure --prefix=/home/mkdocs/python3 make && make install #配置环境变量 vi ~/.bash_profile #添加此配置 PATH=$PATH:/home/mkdocs/python3/bin source ~/.bash_profile #软连接 sudo ln -sf /home/mkdocs/python3/bin/python3.7 /usr/bin/python3 sudo ln -sf /home/mkdocs/python3/bin/pip3.7 /usr/bin/pip3 #验证 python3 --version pip3 --version ``` - mkdocs安装 ``` # 官网安装(较慢,可以通过如下国内源加速) pip3 install mkdocs # 清华源 # 安装后二进制命令在如上./configure指定的/home/mkdocs/python3/bin pip3 install mkdocs -i https://pypi.tuna.tsinghua.edu.cn/simple # 其他国内源 http://mirrors.aliyun.com/pypi/simple/ http://pypi.douban.com/simple/ # 命令检查 mkdocs -V mkdocs, version 1.4.2 from /home/mkdocs/python3/lib/python3.8/site-packages/mkdocs (Python 3.8) ``` - mkdocs主题插件安装 ``` pip3 install mkdocs-material -i https://pypi.tuna.tsinghua.edu.cn/simple ``` - mkdocs常用命令 ``` 创建一个工程: mkdocs new [dir-name] mkdodcs serve -a ip:port mkdocs build # 生成静态站点 mkdocs help ``` - mkdocs目录结构及配置文件参考 ``` # tree -L 3 . ├── docs │   ├── about.md │   ├── door │   │   └── test-01.md │   ├── index.md │   └── test.md ├── mkdocs.yml ├── mkdocs.yml.default └── site //执行过mkdocs build之后生成的静态资源 ├── 404.html ├── about │   └── index.html ├── assets │   ├── images │   ├── javascripts │   └── stylesheets ├── index.html ├── search │   └── search_index.json ├── sitemap.xml ├── sitemap.xml.gz └── test └── index.html ``` ``` $ cat mkdocs.yml #站点配置说明 site_name: Docs #站点名称 docs_dir: docs #文档地址 markdown_extensions: - admonition - pymdownx.details - pymdownx.superfences #主题配置 theme: name: material #指定主题 language: en search_index_only: true palette: - media: "(prefers-color-scheme: dark)" primary: teal scheme: default toggle: icon: material/weather-night name: Switch to light mode - media: "(prefers-color-scheme: light)" scheme: slate toggle: icon: material//weather-sunny name: Switch to dark mode features: #- navigation.instant # 点击内部链接时,不用全部刷新页面 - navigation.tracking # 在url中使用标题定位锚点 - navigation.tabs # 顶部显示导航顶层nav(也就是第一个节点) - navigation.tabs.sticky # 滚动是隐藏顶部nav,需要配合navigation.tabs使用 - navigation.sections # nav节点缩进 - navigation.expand # 不折叠左侧nav节点 - navigation.indexes # 指定节点index pages ,跟instant不兼容 - toc.integrate # 右侧生产目录 - toc.integrate #导航集成 - navigation.top # 一键回顶部 - header.autohide - search.share # 搜索分享 - search.suggest # 搜索建议 - search.highlight #搜索高亮 icon: admonition: note: octicons/tag-16 abstract: octicons/checklist-16 info: octicons/info-16 tip: octicons/squirrel-16 success: octicons/check-16 question: octicons/question-16 warning: octicons/alert-16 failure: octicons/x-circle-16 danger: octicons/zap-16 bug: octicons/bug-16 example: octicons/beaker-16 quote: octicons/quote-16 repo_name: gitee repo_url: http://happyhelloworld.gitee.io/mkdocs-blog/ site_name: Mkdocs博客学习 site_description: 文档 site_author: happyhelloworld site_url: http://happyhelloworld.gitee.io/mkdocs-blog/ copyright: Copyright © 2022 Powered by http://happyhelloworld.gitee.io 版权所有 extra: analytics: provider: google property: !ENV GOOGLE_ANALYTICS_KEY social: - icon: fontawesome/brands/github link: https://github.com - icon: fontawesome/brands/docker link: https://hub.docker.com - icon: fontawesome/brands/python link: https://pypi.org/project/mkdocs-material/ - icon: fontawesome/brands/bilibili link: https://www.bilibili.com/ - icon: fontawesome/solid/paper-plane link: mailto: #联系方式 nav: - Home: index.md - Linux: test.md - Ansible: - 1. Ansible 介绍: door/test-01.md - 2. 安装 Ansible: test-02.md - 3. 快速开始: test-03.md - 4. 认识主机清单: test-04.md - 5. Patterns 匹配: test-05.md - 6. 使用 ad-hoc 命令: test-06.md - 7. 熟悉 ansible 命令: test-07.md - 8. 使用 Playbook: test-08.md - 9. 包含和角色: test-09.md - 10. 使用变量: test-10.md - 11. Facts 数据: test-11.md - 12. Jinja2 模板语法: test-12.md - 13. 条件判断与循环: test-13.md - 14. Blocks: test-14.md - 15. Playbook 高级特性: test-15.md - 扩展阅读(深入必读): - 1. YAML 语法: test-e01.md - 2. Vaults 加密数据: test-e02.md - 3. 关键字使用: test-e03.md - 4. 模块索引: test-e04.md - 5. Ansible 配置: test-e05.md - Npm: test.md - SpringCloud: test.md - Docker: test.md - DevOps: test.md - Kubernetes: - test1: test.md - test2: test.md - About: about.md ``` - 参考样式 ![](./image/mkdocs-show-01.png) ![](./image/mkdocs-show-02.png) ### 参考文档 ``` 官网: https://www.mkdocs.org/ ``` ### 历史事件 #### 2023-04-10|目录整合,gitee pages #### 2023-04-08|安装配置基本使用 #### 2023-04-07|创建文档