hexo文件夹大小写

hexo 生成文件大小写问题

_config.yaml中的配置更改。清理后重新生成新的文件夹就是小写的。

默认是0,文件夹首字母是大写的。

1
filename_case: 1

hexo 设置 category 页面分类小写

找到主题文件夹中的 layout 目录,我的是D:\hexo\themes\next\layout\category.njk

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
{% extends '_layout.njk' %}
{% import '_macro/post-collapse.njk' as post_template with context %}
{% import '_macro/sidebar.njk' as sidebar_template with context %}
{#####注释掉,不想显示 ###}
{###{% block title %}{{ __('title.category') }}: {{ page.category }} | {{ title }}{% endblock %}###}

{% block title %} {{ page.category.toLowerCase() }} | {{ title }}{% endblock %}
{% block class %}category posts-collapse{% endblock %}

{% block content %}

{######################}
{### CATEGORY BLOCK ###}
{######################}
<div class="post-block">
<div class="post-content">
<div class="collection-title">
<h1 class="collection-header">
{#####这里设置,添加toLowerCase(),不然是驼峰大写命名法###}
{{- page.category.toLowerCase() }}
{####注释掉,不想显示 <small>{{ __('title.category') }}</small>###}
</h1>
</div>

{{ post_template.render(page.posts) }}
</div>
</div>
{##########################}
{### END CATEGORY BLOCK ###}
{##########################}

{%- include '_partials/pagination.njk' -%}

{% endblock %}

{% block sidebar %}
{{ sidebar_template.render(false) }}
{% endblock %}

hexo 设置 tag 页面标签小写

找到主题文件夹中的 layout 目录,我的是D:\hexo\themes\next\layout\tag.njk

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
{% extends '_layout.njk' %}
{% import '_macro/post-collapse.njk' as post_template with context %}
{% import '_macro/sidebar.njk' as sidebar_template with context %}
{####注释掉,不想显示####}
{####{% block title %}{{ __('title.tag') }}: {{ page.tag.toLowerCase() }} | {{ title }}{% endblock %}####}


{% block title %} {{ page.tag.toLowerCase() }} | {{ title }}{% endblock %}
{% block class %}tag posts-collapse{% endblock %}

{% block content %}

{#################}
{### TAG BLOCK ###}
{#################}
<div class="post-block">
<div class="post-content">
<div class="collection-title">
<h1 class="collection-header">
{{- page.tag.toLowerCase() }}
{####注释掉,不想显示 <small>{{ __('title.tag') }}</small>####}
</h1>
</div>

{{ post_template.render(page.posts) }}
</div>
</div>
{#####################}
{### END TAG BLOCK ###}
{#####################}

{%- include '_partials/pagination.njk' -%}

{% endblock %}

{% block sidebar %}
{{ sidebar_template.render(false) }}
{% endblock %}

hexo 设置首页中文章的分类于小写

找到主题文件夹中的 layout 目录,我的是D:\hexo\themes\next\layout\_partials\post\post-meta.njk

将在cat.name后面添加.toLowerCase()

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
<div class="post-meta">
{%- set date_diff = date(post.date) != date(post.updated) %}
{%- set time_diff = time(post.date) != time(post.updated) %}

{%- if theme.post_meta.created_at %}
<span class="post-meta-item">
<span class="post-meta-item-icon">
<i class="far fa-calendar"></i>
</span>
<span class="post-meta-item-text">{{ __('post.posted') }}</span>

{%- if not date_diff and time_diff and theme.post_meta.updated_at.enable and theme.post_meta.updated_at.another_day %}
{%- set create_title = __('post.created') + __('symbol.colon') + full_date(post.date) + ' / ' + __('post.modified') + __('symbol.colon') + time(post.updated) %}
{% else %}
{%- set create_title = __('post.created') + __('symbol.colon') + full_date(post.date) %}
{%- endif %}

<time title="{{ create_title }}" itemprop="dateCreated datePublished" datetime="{{ moment(post.date).format() }}">{{ date(post.date) }}</time>
</span>
{%- endif %}

{%- if theme.post_meta.updated_at.enable and (not theme.post_meta.updated_at.another_day or date_diff or not theme.post_meta.created_at) %}
<span class="post-meta-item">
<span class="post-meta-item-icon">
<i class="far fa-calendar-check"></i>
</span>
<span class="post-meta-item-text">{{ __('post.edited') }}</span>
<time title="{{ __('post.modified') + __('symbol.colon') + full_date(post.updated) }}" itemprop="dateModified" datetime="{{ moment(post.updated).format() }}">{{ date(post.updated) }}</time>
</span>
{%- endif %}

{%- if post.categories and post.categories.length and theme.post_meta.categories %}
<span class="post-meta-item">
<span class="post-meta-item-icon">
<i class="far fa-folder"></i>
</span>
<span class="post-meta-item-text">{{ __('post.in') }}</span>
{%- for cat in post.categories.toArray() %}
<span itemprop="about" itemscope itemtype="http://schema.org/Thing">
{####cat.name.toLowerCase()####}
<a href="{{ url_for(cat.path) }}" itemprop="url" rel="index"><span itemprop="name">{{ cat.name.toLowerCase() }}</span></a>
</span>

{%- set cat_length = post.categories.length %}
{%- if cat_length > 1 and loop.index !== cat_length %}
{{ __('symbol.comma') }}
{%- endif %}
{%- endfor %}
</span>
{%- endif %}

{# LeanCloud PageView #}
{%- if theme.leancloud_visitors.enable %}
<span id="{{ url_for(post.path) }}" class="post-meta-item leancloud_visitors" data-flag-title="{{ post.title }}" title="{{ __('post.views') }}">
<span class="post-meta-item-icon">
<i class="far fa-eye"></i>
</span>
<span class="post-meta-item-text">{{ __('post.views') + __('symbol.colon') }}</span>
<span class="leancloud-visitors-count"></span>
</span>
{%- endif %}

{%- if theme.firestore.enable %}
<span class="post-meta-item" title="{{ __('post.views') }}">
<span class="post-meta-item-icon">
<i class="far fa-eye"></i>
</span>
<span class="post-meta-item-text">{{ __('post.views') + __('symbol.colon') }}</span>
<span class="firestore-visitors-count"></span>
</span>
{%- endif %}

{%- if not is_index and theme.busuanzi_count.enable and theme.busuanzi_count.post_views %}
<span class="post-meta-item" title="{{ __('post.views') }}" id="busuanzi_container_page_pv">
<span class="post-meta-item-icon">
<i class="{{ theme.busuanzi_count.post_views_icon }}"></i>
</span>
<span class="post-meta-item-text">{{ __('post.views') + __('symbol.colon') }}</span>
<span id="busuanzi_value_page_pv"></span>
</span>
{%- endif %}

{{- next_inject('postMeta') }}

{%- if theme.symbols_count_time.separated_meta and config.symbols_count_time.symbols and config.symbols_count_time.time %}
<span class="post-meta-break"></span>
{%- endif %}

{%- if config.symbols_count_time.symbols %}
<span class="post-meta-item" title="{{ __('symbols_count_time.count') }}">
<span class="post-meta-item-icon">
<i class="far fa-file-word"></i>
</span>
<span class="post-meta-item-text">{{ __('symbols_count_time.count') + __('symbol.colon') }}</span>
<span>{{ symbolsCount(post) }}</span>
</span>
{%- endif %}

{%- if config.symbols_count_time.time %}
<span class="post-meta-item" title="{{ __('symbols_count_time.time') }}">
<span class="post-meta-item-icon">
<i class="far fa-clock"></i>
</span>
<span class="post-meta-item-text">{{ __('symbols_count_time.time') }} &asymp;</span>
<span>{{ symbolsTime(post, config.symbols_count_time.awl, config.symbols_count_time.wpm, __('symbols_count_time.time_minutes')) }}</span>
</span>
{%- endif %}
</div>

hexo 更改 url 中 uri

更改hexo_config.yaml

1
2
#permalink: :year/:month/:day/:title/  默认显示年月日加标题的,更改成只显示标题
permalink: :title/