预览

upload successful

安装依赖

执行命令

1
npm i hexo-githubcalendar --save

添加配置

要放到hexo根目录下_config.yml文件,非主题:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
githubcalendar:
enable: true # 是否启用本插件
enable_page: / # 要生效的页面,如 / 首页,/about/ 介绍页等
user: w00123 # GitHub 用户名
layout:
type: id
name: recent-posts
index: 0
githubcalendar_html: '<div class="recent-post-item" style="width:100%;height:auto;padding:10px;"><div id="github_loading" style="width:10%;height:100%;margin:0 auto;display: block"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 50 50" style="enable-background:new 0 0 50 50" xml:space="preserve"><path fill="#d0d0d0" d="M25.251,6.461c-10.318,0-18.683,8.365-18.683,18.683h4.068c0-8.071,6.543-14.615,14.615-14.615V6.461z" transform="rotate(275.098 25 25)"><animateTransform attributeType="xml" attributeName="transform" type="rotate" from="0 25 25" to="360 25 25" dur="0.6s" repeatCount="indefinite"></animateTransform></path></svg></div><div id="github_container"></div></div>'
pc_minheight: 280px
mobile_minheight: 0px
# 贡献统计的梯度色卡值,可自行调整
color: "['rgba(255, 255, 255, 0.3)', '#fdcdec', '#fc9bd9', '#fa6ac5', '#f838b2', '#f5089f', '#c4067e', '#92055e', '#540336', '#48022f', '#30021f']"
# 推荐填写你自建的API接口,公用api随时可能会失效
# api: https://github-calendar-api.meta-code.top/api
api: https://githubcalendarapi.shiguang666.eu.org/api
# 推荐下载后使用本地文件
# calendar_js: https://cdn.jsdelivr.net/gh/barry-flynn/hexo-github-calendar/hexo_githubcalendar.js # 在线文件,容易加载失败
calendar_js: /js/hexo_githubcalendar.js # 本地文件,请下载到主题文件夹的source目录下
plus_style: ""

自建api

github作者:https://github.com/Zfour/python_github_calendar_api?tab=readme-ov-file
测试方法未根据作者提供的url,在建好的url后加上/api?user=

如果报错500,可根据这位时光大佬的操作修改:https://www.cnblogs.com/an-shiguang/p/18269053

记录500错误处理方法

进入项目选择setting

下拉找到Node.js Version修改版本为18.0
upload successful

重新部署

项目中选择Deployments点击Redeploy即可
upload successful