Hexo (sakura) add the weather widget, a custom route

First, add the weather widget

First, go to the official website of China weather: https://cj.weather.com.cn/plugin/pc , configure your own plug-ins:
(Tips: free, but requires registration account)

  • Select the custom plug-ins
  • Custom Style
  • Generated code, copy and paste themes / sakura / layout.ejs to
<!-- weather -->
<script type="text/javascript">
  WIDGET = {FID: 'yqRrzxwtvs'}
  </script>
  <script type="text/javascript" src="https://apip.weatherdt.com/float/static/js/r.js?v=1111"></script>

Here Insert Picture Description

Second, the article generate custom link

The default theme is a link to the article configuration

premalink: :year/:month/:day/:title

This generates a link address long article copyright will link address a long list of character encoding, and does not look good. It is necessary to change the format of articles to generate links.

  1. First installed in the root directory hexo-abbrlinkplug-ins:

    npm install hexo-abbrlink --save
    
  2. Modify the main configuration file

    • Adds: Enable algorithm to generate the file number is not repeated
      ## 启用算法生成不重复文件编号
      abbrlink:
      	  alg: crc16   #算法: crc16(default) and crc32
      	  rep: hex   #进制: dec(default) and hex: dec #输出进制:十进制和十六进制,默认为10进制。丨dec为十进制,hex为十六进制
      
    • Review: permalink: post/:abbrlink.html
      (here you can set up their own, can also be used directly: / abbrlink)
      permalink: post/:abbrlink.html 
      

Here Insert Picture Description
Generate links to articles format will be as follows sample (official sample):

crc16 & hex
https://post.zz173.com/posts/66c8.html

crc16 & dec
https://post.zz173.com/posts/65535.html
crc32 & hex
https://post.zz173.com/posts/8ddf18fb.html

crc32 & dec
https://post.zz173.com/posts/1690090958.html

After generation, the field will increase abbrlink md Front-matter of the original file, is generated's ID. This field ensures that after we modified the blog title in the Front-matter title or date of creation date field without changing the link address.

Published 204 original articles · won praise 354 · views 130 000 +

Guess you like

Origin blog.csdn.net/cungudafa/article/details/104312892