hexo:raytaylorism主题增加天气插件和公安备案
声明:本文仅限用于学术交流,引用或转载本文时请注明出处!
一直打算给自己基于hexo的博客增加天气的插件,以前有心知专门为hexo的插件,但自从今年维护之后,再也没有了。参考网上教程添加了插件
增加天气插件
获取代码
参考hexo美化添加天气插件生成自己需要的代码,其中最重要的是FID。
在raytaylorism中保存Javascript代码
在raytaylorism\source\js中创建weather.js
1 | (function(a){var b=a.getElementById("weather-float-he");b&&b.parentNode.removeChild(b);b=a.createElement("div");b.id="weather-float-he";a.getElementsByTagName("body")[0].appendChild(b);b=a.createElement("link");b.rel="stylesheet";b.href="https://apip.weatherdt.com/float/static/css/tqw_widget_float.css?v=0101";var c=a.createElement("script");c.src="https://apip.weatherdt.com/float/static/js/tqw_widget_float.js?v=0101";a=a.getElementsByTagName("script")[0];a.parentNode.insertBefore(b,a);a.parentNode.insertBefore(c, |
生成插件
保存raytaylorism\layout\_partial\plugin\weather.ejs
1 | <% if (theme.weather.enabled) { %> |
引入插件
在raytaylorism\layout\_partial\after_footer.ejs
中最后添加下面的代码:
1 | <%- partial('plugin/weather') %> |
修改主题的配置文件
修改_config.yml,在最后面添加:
1 | # 天气插件 |
增加公安备案信息
增加代码
在raytaylorism\layout\_partial\footer.ejs
中添加一下代码:
1 | <% if (theme.gonganbeian.enabled) { %> |
修改配置文件
修改_config.yml,在最后面添加:
1 | gonganbeian: |
参考文献

欢迎您扫一扫上面的微信公众号,订阅我的博客!