惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

博客园_首页
C
Check Point Blog
B
Blog RSS Feed
G
Google Developers Blog
H
Help Net Security
博客园 - Franky
Blog — PlanetScale
Blog — PlanetScale
H
Hackread – Cybersecurity News, Data Breaches, AI and More
量子位
Recent Announcements
Recent Announcements
B
Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
D
DataBreaches.Net
小众软件
小众软件
T
The Blog of Author Tim Ferriss
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
MongoDB | Blog
MongoDB | Blog
Y
Y Combinator Blog
T
Tailwind CSS Blog
J
Java Code Geeks
MyScale Blog
MyScale Blog
雷峰网
雷峰网
有赞技术团队
有赞技术团队
博客园 - 聂微东

一颗小树

周更的第 100 篇 改变阅读方式 宝贵的人生建议 小树的工具库 2023 读《重构》有感 仅需 10 分钟,用 GPTs 实现文章总结助手 高质量的需求交付 产品始于问题,而不是解决方案 如何更好地休息 最优解人生 与体重斗,其乐无穷 结构化 prompt = 数字员工? 持续创作的法门 如何降低知识焦虑 7 月思维碎片 N 倍生产力提升:我的 AI 助理 Indie Hacker,互联网打工人的下一个出路? 如何成就伟大事业 夏日碎片 小报编辑的自我修养 一颗小树 #49 投入真实生活 一颗小树 #48 过年杂记 一颗小树 #47 我的人生信念(2023) 一颗小树 #46 回本就卖 一颗小树 #45 规划和落地 小树的 2022 年终总结 一颗小树 #44 构建高质量信源 一颗小树 #43 我的 2022 书单 一颗小树 #42 阳了怎么办 一颗小树 #41 一人企业
hexo配置文件初识及主题更换
也树 · 2016-02-17 · via 一颗小树

第一篇只是完成了基础的博客建立,接下来再带大家认识一下 hexo 中很重要的一部分—配置文件,里面包含了很多有用的配置选项,了解之后能使自己的博客更加定制化。同时默认的主题大家肯定也不会都喜欢,这个时候就需要更换主题。这一篇就带大家认识这两部分。

作者:Icarus 原文链接:hexo 配置文件初识及主题更换

配置文件 _config.yml

# Hexo Configuration
## Docs: https://hexo.io/docs/configuration.html
## Source: https://github.com/hexojs/hexo/

# Site #博客的基本信息
title: 自留地 #博客标题
subtitle: #博客副标题
description: 前端|伪文青|工科男 #博客描述,部分主题会用来生成简介
author: 卢睿韬 #博客作者
language: zh-Hans #语言
timezone:

# URL
## If your site is put in a subdirectory, set url as 'https://yoursite.com/child' and root as '/child/'
url: https://yoursite.com #你自己的域名
root: / #根目录位置,如果只是github pages的子目录需要更改
permalink: :year/:month/:day/:title/
permalink_defaults:

# Directory #文件结构 默认即可
source_dir: source
public_dir: public
tag_dir: tags
archive_dir: archives
category_dir: categories
code_dir: downloads/code
i18n_dir: :lang
skip_render:

# Writing #编辑博文的选项
new_post_name: :title.md # File name of new posts
default_layout: post
titlecase: false # Transform title into titlecase
external_link: true # Open external links in new tab
filename_case: 0
render_drafts: false
post_asset_folder: false
relative_link: false
future: true
highlight: #代码高亮
  enable: true #是否启用
  line_number: true #是否显示行号
  auto_detect: true
  tab_replace:

# Category & Tag #分类与标签
default_category: uncategorized
category_map:
tag_map:

# Date / Time format #日期显示格式
## Hexo uses Moment.js to parse and display date
## You can customize the date format as defined in
## https://momentjs.com/docs/#/displaying/format/
date_format: YYYY-MM-DD
time_format: HH:mm:ss


# Pagination #分页器
## Set per_page to 0 to disable pagination
per_page: 3
pagination_dir: page

# Extensions #拓展
## Plugins: https://hexo.io/plugins/
## Themes: https://hexo.io/themes/
theme: next #主题更换

# Deployment #部署参数
## Docs: https://hexo.io/docs/deployment.html
deploy:
  type: git
  repo: https://github.com/xdlrt/xdlrt.github.io.git
  branch: master

index_generator:
  per_page: 3 ##首頁默认10篇文章标题 如果值为0不分页

archive_generator:
  per_page: 10 ##归档页面默认10篇文章标题
  yearly: true  ##生成年视图
  monthly: true ##生成月视图

tag_generator:
  per_page: 10 ##标签分类页面默认10篇文章

category_generator:
   per_page: 10 ###分类页面默认10篇文章

以上就是配置文件的基础设置。

更换主题 NexT

Hexo 安装主题的方式非常简单,只需要将主题文件放置于站点目录的 themes 下,然后修改下配置文件即可。这里我以 NexT 主题为例。 在 git CMD 操作下 cd 至博客根目录,执行如下代码:

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

等待下载完成后,修改根目录下_config.yml 文件的 theme 字段为 next 即可启用 NexT 主题,十分简单便捷。 Schemes 目前共有三种:Muse Mist Pisces,三种都很简洁清新,我使用的是 Pisecs。 其它具体设置可参照NexT 官方文档