blog搭建

安装hexo

添加国内镜像源
安装hexo: npm i hexo-cli -g
初始化文件夹: hexo init
安装必备组件: npm install

hexo常用命令

hexo g  # 生成博客网页文件
hexo s  # 本地预览博客
hexo d  # 上传网页文件到github
hexo new post "article title" # 新建一篇文章(需要插件)
hexo clean # 清除默认缓存

icarus主题

安装

https://github.com/ppoffice/hexo-theme-icarus

参考链接

https://big-news.cn/2019/08/12/hexo%E4%B8%BB%E9%A2%98Icarus%E6%B5%85%E5%BA%A6%E4%BF%AE%E6%94%B9%E6%95%99%E7%A8%8B/#%E7%AB%99%E7%82%B9%E6%8E%A8%E9%80%81
https://www.cnblogs.com/KongkOngL/p/10449269.html
https://susreal.com/article/2019/hexo-theme-icarus-3/
https://www.imaegoo.com/2019/icarus-night-mode-2/
https://blog.csdn.net/qq_41793001/article/details/103055201

next-Gemini主题配置

下载next主题

$ cd hexo-site
$ git clone https://github.com/next-theme/hexo-theme-next themes/next
icarus 主题https://github.com/ppoffice/hexo-theme-icarus

启用next

​ (1)打开博客根目录下的_config.yml文件,将Theme修改为next--> theme: next

​ (2)修改hexo默认风格,在themes/next/_config.yml中修改配置scheme: Gemini

添加社交帐号

themes/next/_config.yml中修改配置


# ---------------------------------------------------------------
# Sidebar Settings
# ---------------------------------------------------------------

# Social Links.
# Usage: `Key: permalink || icon`
# Key is the link label showing to end users.
# Value before `||` delimeter is the target permalink.
social:
  GitHub: https://github.com/yourname || github
  E-Mail: mailto:yourname@gmail.com || envelope
  #Google: https://plus.google.com/yourname || google
  #Twitter: https://twitter.com/yourname || twitter
  #FB Page: https://www.facebook.com/yourname || facebook
  #VK Group: https://vk.com/yourname || vk
  #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

文章字数统计

安装插件:

npm i --save hexo-wordcount

themes/next/_config.yml中修改配置,

# Post wordcount display settings
# Dependencies: https://github.com/willin/hexo-wordcount
post_wordcount:
  item_text: true
  wordcount: true
  min2read: true
  totalcount: true
  separated_meta: true

打开 post.swig 文件,/themes/next/layout/_macro/post.swig,在对应数字后增加单位:
字数:

<span title="{{ __('post.wordcount') }}">
    {{ wordcount(post.content) }} 字
</span>

阅读时长:

<span title="{{ __('post.min2read') }}">
    {{ min2read(post.content) }} 分钟
</span>

添加站内搜索

安装插件:

npm install hexo-generator-search --save

themes/next/_config.yml中修改配置:

# Local search
# Dependencies: https://github.com/flashlab/hexo-generator-search
local_search:
  enable: true
  # if auto, trigger search by changing input
  # if manual, trigger search by pressing enter key or search button
  trigger: auto
  # show top n results per article, show all results by setting to -1
  top_n_per_article: 1

页面底部主题信息删除

打开themes中的next文件夹,找到_config.yml文件,修改footer下面的配置为false即可。

copyright:
# -------------------------------------------------------------
# Hexo link (Powered by Hexo).
powered: false

theme:
  # Theme & scheme info link (Theme - NexT.scheme).
  enable: false
  # Version info of NexT after scheme info (vX.X.X).
  version: false
posted @ 2020-11-05 22:14  Runope丶  阅读(185)  评论(0编辑  收藏  举报