前言
记录使用Hexo-theme-Anzhiyu中遇到的问题及解决方法。
遇到问题请先查阅 Anzhiyu主题文档,这里是最快的解决方法,其次搜索``
本站基于 Hexo-theme-Anzhiyu 主题,未改动主题源码,只增加了自定义css和js。
本博客完全开源仓库地址:https://github.com/gavinblog/blog-anzhiyu
音乐馆无法正常播放
原因
由于MetingJs
自带官方api无法正常访问.
解决
更换API接口,搜索可用接口或者自建api接口。
在配置文件中_config.anzhiyu.yml
,修改meting_api
自定义meting_api
- 自建API:
https://api-meting.geekswg.top/api
,来自开源仓库。
- 其他API:
https://api.injahow.cn/meting/
Anzhiyu主题使用下面的方法即可:
1 2 3
|
meting_api: 'https://api.injahow.cn/meting/?server=:server&type=:type&id=:id&auth=:auth&r=:r'
|
注意:改完后一定要重新编译
生成静态页面,命令如下。
1
| hexo cl | hexo g | hexo s
|
其他通用解决方法,适用于所有html中引入的,官方文档有说明自定义 meting_api。
1 2 3 4
| <script> var meting_api='https://api.injahow.cn/meting/?server=:server&type=:type&id=:id&auth=:auth&r=:r'; </script>
|
文章加密功能实现
插件安装
安装命令
1
| npm install --save hexo-blog-encrypt
|
使用方法
在文章中的Front matter配置方法
1 2 3 4 5 6
| password: 1234 theme: xray abstract: 有东西被加密了, 请输入密码查看. message: 您好, 这里需要密码. wrong_pass_message: 抱歉, 这个密码看着不太对, 请再试试. wrong_hash_message: 抱歉, 这个文章不能被校验, 不过您还是能看看解密后的内容.
|
Github-Action自动部署
该action实现功能,提交源码到github自动部署生成hexo静态博客到gh-pages分支。
可根据自己需求改造aciton,步骤通用
实现源码
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90
| name: 自动发布-auto-deploay-hexo
on: push: branches: - master
env: TZ: Asia/Shanghai
jobs: blog-deploy: name: Hexo blog build & deploy
runs-on: ubuntu-latest steps: - name: Checkout codes uses: actions/checkout@v3 with: submodules: true
- name: Setup node uses: actions/setup-node@v1 with: node-version: '16.x'
- name: Cache node modules uses: actions/cache@v1 with: path: ~/.npm key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
- name: Install hexo dependencies run: | npm install -g hexo-cli npm install --no-fund npm install hexo-renderer-pug hexo-renderer-stylus --save npm install hexo-generator-search --save npm install hexo-abbrlink --save npm install hexo-offline --save npm install --save hexo-blog-encrypt npm ls --depth 0
- name: Generate files run: | hexo clean hexo generate
- name: Deploy uses: peaceiris/actions-gh-pages@v3 with: github_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: ./public
user_name: 'github-actions[bot]' user_email: 'github-actions[bot]@users.noreply.github.com' commit_message: ${{ github.event.head_commit.message }} tag_name: ${{ steps.prepare_tag.outputs.DEPLOY_TAG_NAME }} tag_message: 'Deployment ${{ github.ref_name }}'
|
转载文章配置
在文章的头部Front-matter中配置以下信息
持续更新中~~~
遇到常见问题记录更新中。