1. 程式人生 > 實用技巧 >next v5升級到next v7需要注意的地方

next v5升級到next v7需要注意的地方


title: next v5升級到next v7需要注意的地方
date: 2020-03-04
categories: web
tags: [hexo,next]

大部分的設定都是一樣的,但有一些細節要注意

1.背景圖片的設定:next v5.X 在source/css/_cumtom.styl設定, 而next v7.x 修改兩處:

“next主題配置檔案“ _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/styles.styl      #這裡去掉了註釋的#

然後在 “站點根目錄“ source新建資料夾 _data,其中新建styles.styl檔案,在檔案裡設定。(這裡 source/是網站根目錄,若是/source就是主題目錄)

@media screen and (min-width:1200px) {


    #footer a {
        color:#eee;
    }



body {
      background: url(/images/bg1.jpg);
      background-size: cover;
      background-repeat: no-repeat;
      background-attachment: fixed;
      background-position: 50% 50%;
}

}

2. “next主題配置檔案” _config.yml 中social 和social icon的設定。

2.1next v5 可以新增一些其他的連結,比如cnblog,但是v7好像不可以。 否則會出現開啟網頁空白的現象。

2.2另外比如說添加了Github的連結,就要把Github的註釋去掉,不要重複。

正確的如下

social:
  GitHub: https://github.com/TouwaErioH || github
  E-Mail: mailto:[email protected] || envelope
  #Weibo: https://weibo.com/yourname || weibo
  #Google: https://plus.google.com/yourname || google
  #Twitter: https://twitter.com/yourname || twitter
  #FB Page: https://www.facebook.com/yourname || facebook
  #StackOverflow: https://stackoverflow.com/yourname || stack-overflow
  #YouTube: https://youtube.com/yourname || youtube
  #Instagram: https://instagram.com/yourname || instagram
  #Skype: skype:yourname?call|chat || skype

social_icons:
  enable: true
  icons_only: false
  transition: false