Insert a calendar like Github contributions into your hexo blog.
npm install hexo-calendarInsert a calendar like Github contributions into your blog.
> Note: This plugin will conflict with the hexo g command, please use hexo ge or hexo generate instead of the hexo g command!
> Note: The plugin cannot be used if the prerequisites are not met, and the problems of installing this plugin when the prerequisites are not met will not be dealt with, and how to achieve the following prerequisites will not be dealt with!
1. Node.js >= 12.0
2. Use Git to manage the blog source code.
3. Use the git log -1 --date=iso --pretty=format:"%ad" command in the blog root directory to output a date.
4. How to determine whether the first item meets:
1. The blog root directory contains the .git folder, which is a hidden folder.
2. Meets the third item above.
``shell`
npm i hexo-calendar -S`
orshell`
cnpm i hexo-calendar -S
`ejs`
<%- calendar({monthLang: 'en', dayLang: 'en', title: 'calendar'}) %>
> Note: Please use strict JSON format for this method!
`nunjucks`
{% calendar %}
{"monthLang": "en", "dayLang": "en", "title": "calendar"}
{% endcalendar %}
If you use automatic deployment such as Travis CI, Github Action, then you need to use the hexo gc -w=40 command to generate a calendar.json file before pushing the source code. -w=40 means to display activity records from 40 weeks ago to the present.
| Name | Type | Default value | Description |
| :-----: | :-----: | :-----: | :-----: |
| width | String | "100%" | Calendar width, e.g.: "width": "90%", "width": "600px" (with unit px), prefer to use percentage format |String
| height | | "185px" | Calendar height, e.g.: "height": "185px"(with unit px), do not use percentage format |String
| id | | "calendar" | Calendar element id |String
| monthLang | or Array | "en" | Month language, optional: en, cn or custom |String
| dayLang | or Array | "en" | Language for every day of the week, optional: en, cn or custom |Number
| weeks | | 40 | Show how many weeks ago to the present activity record |String
| title | | "calendar" | Calendar title |Boolean
| insertScript | | true | Whether to automatically insert the echarts library. If you have imported the echarts library globally, please set this to false; if your site has pjax enabled, please set this to false and reference the echarts library globally. |Object
| color | | null | Color options |String
| color.background | | "#f9f9f9" | Background color |String
| color.tooltip.background | | "#555" | Tooltip's background color |String
| color.tooltip.border | | "#777" | Tooltip's border color |String
| color.visualMap.inRange | | '["#ebedf0", "#c6e48b", "#7bc96f", "#239a3b", "#196127"]' | The colors displayed for different times of submission |String
| color.calendar.itemBorder | | "#fff" | The border color for each data point |String
| color.calendar.monthLabel | | "#3C4858" | Month label color |String
| color.calendar.dayLabel | | "#3C4858" | Day label color |String
| color.calendar.name | | "#3C4858"` | None |