https://geneasy.github.io/nav/
这是一个通用的网址导航模板,任何类型的网站都可以拿去使用。
此网址导航页面是使用 GenEasy 文档生成工具 + WebStack 模板创建的静态页面,托管在 GitHub Pages 服务器上面。
当修改 links.yml
文件里的内容时,GitHub Actions 会自动更新 HTML 文件。不需要服务器,不需要数据库。
第一步:fork 这个项目 (注意: gh-pages 分支一起复制)
第二步:进入 Settings > Pages, 启用 GitHub Pages 功能。分支选择 gh-pages
。
第三步:2 分钟后,访问你的 GitHub Pages 域名,看看是否正常显示。https://你的用户名.github.io/nav/
或 https://你的用户名.github.io/nav/index.html
第四步:进入 Actions,启用 Actions 功能,进入 Settings,启用 Issues 功能。
第五步:
5.1 如果你的网站是托管在 GitHub Pages 上面,配置已经结束
5.2 如果你的网站部署在自己的服务器,需要添加一段 proxy 代码。
以下是 nginx 代码示例
location /nav/ {
proxy_pass https://你的用户名.github.io/nav/;
proxy_intercept_errors on;
# allow GitHub to pass caching headers instead of using our own
expires off;
proxy_set_header Host 你的用户名.github.io;
proxy_set_header X-Host 你的用户名.github.io;
}
5.3 如果你的网站部署在自己的服务器,不能(会)配置 proxy,你可以添加一个把生成的 HTML rsync 到你的服务器的 GitHub Action。
name: Build and Deploy
on:
push:
branches:
- gh-pages
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: rsync deployments
uses: burnett01/rsync-deployments@5.1
with:
switches: -avzr --delete
path: ./
remote_path: /var/www/html/nav/
remote_host: example.com
remote_user: debian
remote_key: ${{ secrets.DEPLOY_KEY }}
5.4 如果你的网站是托管在 Vercel, Netlify 等静态页面托管平台,需要添加部署到这些平台的 GitHub Action。(与 5.3 类似)
name: Build and Deploy
on:
push:
branches:
- gh-pages
jobs: ...
第六步:访问你的网站,确认是否成功。https://你的域名/nav/