maupassant的基本配置

·200·1 分钟阅读
maupassant

新增标签页面

  1. 在hexo根目录下执行
hexo new page tags
  1. 会发现在source文件夹下多了一个tags文件夹, 点进去找到index.md文件,添加如下配置即可
---
title: tags
date: 2023-10-13 23:11:26
layout: tagcloud
---

添加一个导航 找到主题配置文件的_config.yml文件, 找到menu属性:

menu:
  - page: home
    directory: .
    icon: fa-home
  - page: archive
    directory: archives/
    icon: fa-archive
  - page: tags
    directory: tags/
    icon: fa-tag
  - page: about
    directory: about/
    icon: fa-user

添加网站图标

将favicon.ico放到hexo的根目录source文件夹下即可,推荐像素为32*32, 不会立即生效

增加搜索功能

  1. 安装插件
npm install hexo-generator-search
  1. 添加代码至hexo下面的_config.yml文件
search:
  path: search.xml
  field: post
  content: true
  1. 修改主题下的_config.yml文件
self_search: true
  1. 清除多余的搜索框 做到这里你会发现你的页面多了一个搜索输入框,我来教你解决 找到主题文件下的source/js/search.js 添加脚本
const searchInput = document.querySelector('.widget input')
searchInput.style.display = 'none'