hexo之高级美化篇


增加一些其他功能

简书地址

参考原文地址:hexo建站记

主动推送到百度

参考Hexo插件之百度主动提交链接
安装hexo-baidu-url-submit插件:

npm install hexo-baidu-url-submit --save

该插件在github上:hexo-baidu-url-submit

在根目录的配置文件中增加baidu_url_submit字段,更改deploy字段

baidu_url_submit:
  count: 1000 ## 提交最新的一个链接
  host: alili.tech ## 在百度站长平台中注册的域名
  token: xxxxx ## 请注意这是您的秘钥, 所以请不要把博客源代码发布在公众仓库里!
  path: baidu_urls.txt ## 文本文档的地址, 新链接会保存在此文本文档里
  xz_appid: 'xxxxxx' ## 你的熊掌号 appid
  xz_token: 'xxxxxx' ## 你的熊掌号 token
  xz_count: 10 ## 从所有的提交的数据当中选取最新的10条,该数量跟你的熊掌号而定

deploy:
- type: git
    repo: https://github.com/dfface/dfface.github.io.git
    branch: master
- type: baidu_url_submitter # 百度
- type: baidu_xz_url_submitter # 百度熊掌号

熊掌号的id和token,请看图:
hexo-baidu.png

然后在主题中开启:

# Enable baidu push so that the blog will push the url to baidu automatically which is very helpful for SEO
baidu_push: true

自动换背景

参考:injects
首先写入:source/_data/auto-bg.styl:

// 背景更换设置,原来:background:url(https://source.unsplash.com/random/1600x900);
body {
    background:url("https://img.xjh.me/random_img.php?type=bg&ctype=nature&return=302");
    background-repeat: no-repeat;
    -webkit-background-size:100%;
    background-size:cover;
    -webkit-background-size: cover !important; 
    -moz-background-size: cover !important; 
    -o-background-size: cover; 
    background-attachment:fixed, scroll;
    padding-top: 0px;
}

.main-inner { 
    margin-top: 2rem;
    padding: 2rem;
    background: #fff;
    opacity: 0.7;
    min-height: 500px;
    transition: opacity 1s;
}

header,footer {
    opacity: 0.7;
    transition: opacity 1s;
}

.main-inner:hover {
    opacity:1.0;
}

header:hover {
    opacity:1.0;
}
footer:hover {
    opacity:1.0;
}

body {
  -moz-user-select:none; /* Firefox私有属性 */
  -webkit-user-select:none; /* WebKit内核私有属性 */
  -ms-user-select:none; /* IE私有属性(IE10及以后) */
  -khtml-user-select:none; /* KHTML内核私有属性 */
  -o-user-select:none; /* Opera私有属性 */
  user-select:none; /* CSS3属性 */
}

然后在_config.yml中注释:

custom_file_path:
  #head: source/_data/head.swig
  #header: source/_data/header.swig
  #sidebar: source/_data/sidebar.swig
  #postMeta: source/_data/post-meta.swig
  #postBodyEnd: source/_data/post-body-end.swig
  #footer: source/_data/footer.swig
  #bodyEnd: source/_data/body-end.swig
  #variable: source/_data/variables.styl
  #mixin: source/_data/mixins.styl
  style: source/_data/auto-bg.styl

评论
  目录