静态页面官网
主页搭建
Github page 官方快速入门 https://docs.github.com/cn/pages/quickstart
仓库名称为 [github 名称].github.io
例如我的名称 xieerduos
那么我创建的名称 xieerduos.github.io
包含 index.html 的代码
# 创建目录
mkdir -p gitee.io
# 进入 gitee.io目录
cd gitee.io
# 创建 index.html & mac使用touch 命令 touch index.html
ni index.html
index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>抖音@程序员李钟意首页</title>
</head>
<body>
<h1>抖音@程序员李钟意</h1>
<h2>Hello world</h2>
</body>
</html>
# 初始化仓库
git init
git add .
git commit -m "Initial commit && add index.html file"
# 重命名本地分支
git branch -m master main
# 打开gitee.com 登录,后创建 gitee.io仓库
# 拷贝已有仓库代码
git remote add origin [email protected]:fe521/gitee.io.git
git push -u origin main
# 把本地仓库提交到远程
git push origin main
参考地址:
https://gitee.com/help/articles/4136
- 首页 - 服务 - Gitee Pages
- 点击个人设置完成验证
- 开始认证
- 输入表单信息
- 提交认证
- 等待审核通过
https://docsify.js.org/#/zh-cn/quickstart
npm i docsify-cli -g
docsify init ./docs
docsify serve docs
移动docs/
下的文件到项目根目录
# 修改运行命令
docsify serve .
全文检索
序号 | 插件名称 | URL |
---|---|---|
1 | 全文检索 | https://docsify.js.org/#/zh-cn/plugins?id=%e5%85%a8%e6%96%87%e6%90%9c%e7%b4%a2-search |
<script src="//cdn.jsdelivr.net/npm/docsify/lib/plugins/search.min.js"></script>
window.$docsify = {
// #region 全文检索
search: {
maxAge: 86400000, // 过期时间,单位毫秒,默认一天
paths: 'auto', // or 'auto'
placeholder: '输入关键字搜索',
placeholder: {
'/en/': 'Type to search',
'/': '输入关键字搜索'
},
noData: {
'/en/': 'No Results',
'/': '找不到结果'
},
// 搜索标题的最大层级, 1 - 6
depth: 6,
hideOtherSidebarContent: true, // 是否隐藏其他侧边栏内容
// 避免搜索索引冲突
// 同一域下的多个网站之间
namespace: 'website-1',
// 使用不同的索引作为路径前缀(namespaces)
// 注意:仅适用于 paths: 'auto' 模式
// 初始化索引时,我们从侧边栏查找第一个路径
// 如果它与列表中的前缀匹配,我们将切换到相应的索引
pathNamespaces: ['/en'],
// 您可以提供一个正则表达式来匹配前缀。在这种情况下,
// 匹配到的字符串将被用来识别索引
pathNamespaces: /^(\/(en))?(\/(v1|v2))?/
}
// #endregion
};
其他插件
window.$docsify = {
loadSidebar: true // 定制侧边栏 _sidebar.md生效
};
<!-- 左侧菜单栏 -->
- [抖音@程序员李钟意-首页](/)
- [抖音视频更新记录](/douyin/README.md)
- [Docsify 文档网站搭建过程](/docsify/README.md)
- [移动端适配 vw+rem 解决方案](/frontend/移动端适配vw+rem解决方案.md)
window.$docsify = {
// h1 ~ h6
subMaxLevel: 4 // 默认显示 `####` (h4)以内的标题
};
https://docsify.js.org/#/zh-cn/plugins?id=%e8%b0%b7%e6%ad%8c%e7%bb%9f%e8%ae%a1-google-analytics
登录根据指示操作
数据流 - 创建 - 网站名称、域名等信息填写
再次登录时 - 左下角 - 管理 -数据流
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-C1YQQ3EKMQ"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag() {
dataLayer.push(arguments);
}
gtag('js', new Date());
gtag('config', 'G-C1YQQ3EKMQ');
</script>
新增代码
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/docsify@4/lib/themes/vue.css" />
<!-- docsify-edit-on-github -->
<!-- <script src="//cdn.jsdelivr.net/npm/docsify-edit-on-github"></script> -->
<script>
window.$docsify = {
// ...
plugins: [
// EditOnGithubPlugin.create('https://github.com/xieerduos/xieerduos.github.io/blob/main/', null, '编辑'),
function (hook, vm) {
hook.beforeEach(function (html) {
var url = 'https://github.com/xieerduos/xieerduos.github.io/blob/main/' + vm.route.file;
var editHtml = '[📝 EDIT DOCUMENT](' + url + ')\n';
return editHtml + html + '\n----\n' + 'Last modified {docsify-updated} ' + editHtml;
});
}
]
};
</script>
效果图
window.$docsify = {
loadSidebar: true, // 定制侧边栏 _sidebar.md生效
alias: {
'/.*/_sidebar.md': '/_sidebar.md' // 嵌套的侧边栏
}
};
https://github.com/mermaid-js/mermaid/blob/develop/README.zh-CN.md
把国外 cdn 改为网站本地静态资源