0%

hexo next主题设置

设置目录默认展开

  1. 修改themes/next/_config.yml,搜索custom_file_path,去除style前的#注释符。

  2. 创建source/_data/styles.styl文件,添加下述内容:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    //文章目录默认展开
    .post-toc .nav .nav-child {
    display: block;
    }

    //文章目录字体大小调整
    .post-toc ol {
    font-size : 13px;
    }
  3. 修改themes/next/_config.yml,搜索toc,将wrap设为true

设置中文目录跳转

next中,有时中文目录难以跳转,通过浏览器检查,可以发现如下问题:

根据Github issue的回应,对themes/next/source/js/utils.js修改如下,需要删除两行、添加两行:

添加的两行分别为:

1
2
3
var target = document.getElementById(decodeURI(link.getAttribute('href')).replace('#', ''));

return target;