文件夹说明

创建空白文件夹

image-20241103130019084

  • 显示效果
    image-20241103133536124

实验

布局文件(layout)

  • 创建三个文件[layout|index|post].pug

    从这个实验可以知道,默认显示使用的layout布局文件

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    doctype html
    html(lang='en')
    head
    meta(charset='utf-8')
    meta(name='viewport' content='width=device-width, initial-scale=1')
    body
    //- post文件内容
    a this is post
    //- index文件内容
    a this is index
    //- layout文件内容
    a this is layout

    image-20241103134331384

变量(variable)

网站变量(site)

1
2
3
4
site.posts	所有文章	array,包含了站点全部的文章 object
site.pages 所有分页 array,包含了站点全部的分页 object
site.categories 所有分类 array of ???
site.tags 所有标签 array of ???

各种文件对应关系

生成件和网站的关系

image-20241103150235090

  • 定义位置
    image-20241103150632297

布局文件和生成件的关系

image-20241103152030234

变量属性打印

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
---
title: this_title
categories:
- this_category
series:
- this_series
description: this_description
mathjax: false
katex: false
hide: true
abbrlink: 299cecde
date: 2024-08-18 23:22:19
updated: 2024-11-30 22:19:02
tags:
- diary
top_img:
---

这是mode感情的内容
1
2
3
4
5
6
7
8
9
10
11
12
13
14
- var showTags = site.tags;
- showTags = showTags.filter(function(item) {
- return item.name === 'diary'
- });

- showTags.forEach(function(tag) {
- console.log('id:', tag._id)
- console.log('slug:', tag.slug)
- console.log('path:', tag.path)
- console.log('permalink:', tag.permalink)
- console.log('posts:', tag.posts)
- console.log('length:', tag.length)
- });

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
id: cm38shsee0029bca7canw5adk
slug: diary
path: tags/diary/
permalink: https://limo-bit.github.io/tags/diary/
posts: _Query {
data: [
_Document {
title: 'this_title',
series: [Array],
description: 'this_description',
mathjax: false,
katex: false,
hide: true,
abbrlink: '299cecde',
date: Moment<2024-08-18T23:22:19+08:00>,
updated: Moment<2024-10-28T00:27:01+08:00>,
top_img: null,
_content: '\n这是mode感情的内容',
source: '_posts/日记/随笔/重新开始.md',
raw: '---\n' +
'title: this_title\n' +
'categories:\n' +
' - this_category\n' +
'series:\n' +
' - this_series\n' +
'description: this_description\n' +
'mathjax: false\n' +
'katex: false\n' +
'hide: true\n' +
'abbrlink: 299cecde\n' +
'date: 2024-08-18 23:22:19\n' +
'updated: 2024-10-28 00:27:01\n' +
'tags:\n' +
' - diary\n' +
'top_img:\n' +
'---\n' +
'\n' +
'这是mode感情的内容',
slug: '日记/随笔/重新开始',
published: true,
_id: 'cm38shse8001qbca7cjwn804p',
comments: true,
layout: 'post',
photos: [],
link: '',
content: '<p>这是mode感情的内容</p>\n',
site: [Object],
cover: 'https://files.dbnuo.com/wallpaper/wallhaven-k9p8l6.webp',
cover_type: 'img',
excerpt: '',
more: '<p>这是mode感情的内容</p>\n',
path: [Getter],
permalink: [Getter],
full_source: [Getter],
asset_dir: [Getter],
tags: [Getter],
categories: [Getter],
prev: [_Document],
next: [_Document],
__post: true
}
],
length: 1
}
length: 1
1
2
3
4
5
6
7
8
9
10
11
if page.showseries !== false
include ../mixins/showSeries.pug
//- - console.log(page.showseries)
-console.log(site.all_posts.data[0])
-console.log(site.all_posts.data[0].permalink)
-console.log(site.all_posts.data[0].categories)
-console.log(site.all_posts.data[0].path)
-console.log(site.all_posts.data[0].full_source)
-console.log(site.all_posts.data[0].asset_dir)
-console.log(site.all_posts.data[0].tags)
+showSeries(site.all_posts,page.series)
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
_Document {
title: 'hexo——butterfly修改记录',
mathjax: false,
katex: false,
sticky: 1,
series: [ '从零开始建立hexo主题' ],
description: [ '从使用butterfly主题,到现在所有的修改适配,记录一下,防止以后走丢' ],
abbrlink: '2111689b',
date: Moment<2024-11-03T19:25:31+08:00>,
updated: Moment<2024-11-27T23:06:27+08:00>,
top_img: null,
cover: 'https://gitee.com/ITY996/image/raw/master/XiaoLi/source/_posts/hexo/image/ITY996_241114_cadba8009b07986d.png',
_content: 'testaaa',
source: '_posts/show/hexo/hexo——butterfly修改记录.md',
raw: '---\n' +
'title: hexo——butterfly修改记录\n' +
'mathjax: false\n' +
'katex: false\n' +
'sticky: 1\n' +
'categories:\n' +
' - web前端\n' +
'series:\n' +
' - 从零开始建立hexo主题\n' +
'tags:\n' +
' - hexo\n' +
' - butterfly\n' +
'description: \n' +
'- 从使用butterfly主题,到现在所有的修改适配,记录一下,防止以后走丢\n' +
'abbrlink: 2111689b\n' +
'date: 2024-11-03 19:25:31\n' +
'updated: 2024-11-27 23:06:27\n' +
'top_img:\n' +
'cover: https://gitee.com/ITY996/image/raw/master/XiaoLi/source/_posts/hexo/image/ITY996_241114_cadba8009b07986d.png\n' +
'---\n' +
'testaaa',
slug: 'show/hexo/hexo——butterfly修改记录',
published: true,
_id: 'cm42vqqrk0018qsa7actqbdja',
comments: true,
layout: 'post',
photos: [],
content: '<p>testaaa</p>\n',
cover_type: 'img',
excerpt: '',
more: '<p>testaaa</p>\n',
path: [Getter],
permalink: [Getter],
full_source: [Getter],
asset_dir: [Getter],
tags: [Getter],
categories: [Getter],
__post: true,
postDesc: [ '从使用butterfly主题,到现在所有的修改适配,记录一下,防止以后走丢' ]
}
https://limo-bit.github.io/posts/2111689b.html
_Query {
data: [
_Document {
name: 'web前端',
_id: 'cm42vqqrp001mqsa7geq43401',
slug: [Getter],
path: [Getter],
permalink: [Getter],
posts: [Getter],
length: [Getter]
}
],
length: 1
}
posts/2111689b.html
E:\blog\XiaoLi\source\_posts\show\hexo\hexo——butterfly修改记录.md
E:\blog\XiaoLi\source\_posts\show\hexo\hexo——butterfly修改记录\
_Query {
data: [
_Document {
name: 'hexo',
_id: 'cm42vqqs10031qsa7fukd9b4y',
slug: [Getter],
path: [Getter],
permalink: [Getter],
posts: [Getter],
length: [Getter]
},
_Document {
name: 'butterfly',
_id: 'cm42vqqs20036qsa70zf95ckq',
slug: [Getter],
path: [Getter],
permalink: [Getter],
posts: [Getter],
length: [Getter]
}
],
length: 2
}

image-20241130075422821