Hexo博客搭建之Next主题的安装与设置

关于 Next

Hexo 是一款快速、简洁且高效的博客框架,拥有超快生成速度,支持 Markdown,一键部署和高度可扩展性。

Next 是一个高品质优雅的 Hexo 主题。本文介绍 Next 主题的安装和基本的配置。

安装

前往 GitHub Releases下载最新版本的压缩包解压放置到 Hexo 主题目录下。

或通过下面的命令执行安装

$ cd themes
$ git clone https://github.com/next-theme/hexo-theme-next

将主题目录命名为 next。

使用

启用主题

在根目录下的 _config.yml 文件中,修改主题配置:

theme: next

更改语言

在根目录下的 _config.yml 文件中,修改语言配置:

language: zh-CN

语言包在主题目录下的 languages 目录中。

主题配置

缓存支持

NexT v6+ 允许缓存内容生成。在 NexT 配置文件的 cache 部分设置 enable 为 true:

cache:
  enable: true

缩小支持

NexT 允许缩小 Hexo 生成。在 NexT 配置文件中将 minify 值设置为true:

minify: true

选择 Scheme

Scheme 是 NexT 支持的一个特性,通过使用 Scheme, NexT 可以提供不同的视图。这些 scheme 几乎可以使用所有的配置。目前 NexT 支持 4 种方案,分别是:

  • Muse
  • Mist
  • Pisces
  • Gemini

在 Next 配置文件中搜索 scheme 找到配置的位置,然后配置你想要的 scheme。

#scheme: Muse
#scheme: Mist
scheme: Pisces
#scheme: Gemini

Dark 模式

您可以通过在 NexT 配置文件中将 darkmode 设置为 true 来启用 Dark 模式。

darkmode: true

版本设置

您可以通过编辑 NexT 配置文件中的 creative_commons 部分中的值来配置它。

creative_commons:
  # Available values: by | by-nc | by-nc-nd | by-nc-sa | by-nd | by-sa | cc-zero
  license: by-nc-sa
  # Available values: big | small
  size: small
  sidebar: false
  post: true
  language: deed.zh

sidebar 属性默认为 true ,设为 false 后不显示版本信息。

自定义 Logo

您可以通过在 NexT 配置文件中将图像的 url 添加到 custom_logo 来启用它。

custom_logo: /images/logo.jpg

images 为站点根目录下 source 目录下创建的目录。如果目录不存在请创建它。

自定义头像

您可以通过在 Next 配置文件中,设置 avatar 中的参数来启用它。

avatar:
  # Replace the default image and set the url here.
  url: /images/avatar.jpg
  # If true, the avatar will be displayed in circle.
  rounded: false
  # If true, the avatar will be rotated with the cursor.
  rotated: false

设置导航菜单

默认情况下,所有菜单项都被注释掉,你可以通过设置 menu 中的参数来启用他。

menu:
  home: / || fa fa-home
  #about: /about/ || fa fa-user
  #tags: /tags/ || fa fa-tags
  #categories: /categories/ || fa fa-th
  archives: /archives/ || fa fa-archive
  #schedule: /schedule/ || fa fa-calendar
  #sitemap: /sitemap.xml || fa fa-sitemap
  #commonweal: /404/ || fa fa-heartbeat

除了主页和存档,菜单部分下的所有自定义页面都需要手动创建。

默认情况下 NexT 显示不带标识的菜单项图标。您可以通过编辑 menu_settings 中的值来配置它。

menu_settings:
  icons: true
  badges: false

设置值 badges 为 true,则显示菜单项中的 Posts / Categories / Tags 的计数。

至此,我们已完成了 Next 主题的安装和简单的设置。

猜你喜欢

转载自blog.csdn.net/zyq55917/article/details/125073627
今日推荐