Hexo博客Anzhiyu主题美化,本博客使用的所有美化方案~!

Hexo博客Anzhiyu主题美化

1. 给你的博客添加一个宠物挂件

2. 为主页文章卡片添加擦亮动画效果

3. anzhiyu主题自定义博客字体

推荐使用中文网字计划
  1. 点击进入中文网字计划,选择喜欢的字体样式并点击进入
  2. 拷贝css代码,例如: <link rel='stylesheet' href='https://chinese-fonts-cdn.deno.dev/packages/dymh/dist/DouyinSansBold/result.css' />
  3. _config.anzhiyu.yml 添加css代码
    1
    2
    3
    inject:
    head:
    - <link rel='stylesheet' href='https://chinese-fonts-cdn.deno.dev/packages/dymh/dist/DouyinSansBold/result.css' /> # 添加代码
  4. 搜索 font 修改以下参数
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    font:
    global-font-size: 16px
    code-font-size:
    font-family: 'Douyin Sans' # 修改为网站字体名称
    code-font-family: 'Douyin Sans' # 修改为网站字体名称

    # Font settings for the site title and site subtitle
    # 左上角网站名字 主页居中网站名字
    blog_title_font:
    font_link:
    font-family: 'Douyin Sans' # 修改为网站字体名称
  5. 网站字体名称在此处:
    网站字体名称

4. 更多美化主题


插件类

1. hexo-blog-encrypt 博客加密插件

展开查看

安装

  • npm install --save hexo-blog-encrypt
  • yarn add hexo-blog-encrypt (需要) Yarn

快速使用

  • 将 “password” 字段添加到您文章信息头就像这样。
    1
    2
    3
    4
    5
    ---
    title: Hello World
    date: 2016-03-30 21:18:02
    password: hello
    ---

高级设置

  • 文章信息头

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    ---
    title: Hello World
    tags:
    - 作为日记加密
    date: 2016-03-30 21:12:21
    password: mikemessi
    abstract: 有东西被加密了, 请输入密码查看.
    message: 您好, 这里需要密码.
    wrong_pass_message: 抱歉, 这个密码看着不太对, 请再试试.
    wrong_hash_message: 抱歉, 这个文章不能被校验, 不过您还是能看看解密后的内容.
    ---
  • _config.yml

    1
    2
    3
    4
    5
    6
    7
    8
    9
    # Security
    encrypt: # hexo-blog-encrypt
    abstract: 有东西被加密了, 请输入密码查看.
    message: 您好, 这里需要密码.
    tags:
    - {name: tagName, password: 密码A}
    - {name: tagName, password: 密码B}
    wrong_pass_message: 抱歉, 这个密码看着不太对, 请再试试.
    wrong_hash_message: 抱歉, 这个文章不能被校验, 不过您还是能看看解密后的内容.

2.hexo-hide-posts 隐藏文章插件

展开查看

安装

1
npm install hexo-hide-posts

使用

在文章的 front-matter 中添加 hidden: true 即可隐藏文章。
比如我们隐藏了 source/_posts/lorem-ipsum.md 这篇文章:

1
2
3
4
5
6
7
---
title: 'Lorem Ipsum'
date: '2019/8/10 11:45:14'
hidden: true
---

Lorem ipsum dolor sit amet, consectetur adipiscing elit.

虽然首页上被隐藏了,但你仍然可以通过 https://hexo.test/lorem-ipsum/ 链接访问它。(如果想要完全隐藏一篇文章,可以直接将其设置为草稿
你可以在命令行运行 hexo hidden:list 来获取当前所有的已隐藏文章列表。
插件也在 Local Variables 中添加了 all_postshidden_posts 变量,供自定义主题使用。

配置

在你的站点 _config.yml 中添加如下配置:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
hide_posts:
# 是否启用 hexo-hide-posts
enable: true

# 隐藏文章的 front-matter 标识,也可以改成其他你喜欢的名字
filter: hidden

# 为隐藏的文章添加 noindex meta 标签,阻止搜索引擎收录
noindex: true

# 设置白名单,白名单中的 generator 可以访问隐藏文章
# 常见的 generators 有:index, tag, category, archive, sitemap, feed, etc.
# allowlist_generators: []

# 设置黑名单,黑名单中的 generator 不可以访问隐藏文章
# 如果同时设置了黑名单和白名单,白名单的优先级更高
# blocklist_generators: ['*']

举个栗子:设置 filter: secret 之后,你就可以在 front-matter 中使用 secret: true 来隐藏文章了。