模板错误修正日志
2023年11月5日
格式问题:
1
2
3
4
5
Liquid Exception: Syntax Error in tag 'highlight' while parsing the following markup: Valid syntax: highlight <lang> [linenos] in /home/runner/work/SuYu0304.github.io/SuYu0304.github.io/_posts/2019-08-08-官方文档中英双译.md
------------------------------------------------
Jekyll 4.3.2 Please append `--trace` to the `build` command
for any additional information or backtrace.
------------------------------------------------
原因:
在目录前面写了注释什么的,导致无法识别
改正
将注释放到目录后便就行了
图片链接问题:
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
109
110
111
112
113
114
115
116
117
118
119
120
121
Running 3 checks (Scripts, Links, Images) in ["_site"] on *.html files...
Checking 154 internal links
Checking internal link hashes in 7 files
Ran on 30 files!
For the Images check, the following failures were found:
* At _site/posts/getting-started/index.html:9:
internal image /posts/20180809/pages-source-light.png does not exist
* At _site/posts/getting-started/index.html:9:
internal image /posts/20180809/pages-source-dark.png does not exist
* At _site/posts/text-and-typography/index.html:22:
internal image /posts/20190808/mockup.png does not exist
* At _site/posts/text-and-typography/index.html:22:
internal image /posts/20190808/mockup.png does not exist
* At _site/posts/text-and-typography/index.html:22:
internal image /posts/20190808/mockup.png does not exist
* At _site/posts/text-and-typography/index.html:22:
internal image /posts/20190808/mockup.png does not exist
* At _site/posts/text-and-typography/index.html:22:
internal image /posts/20190808/devtools-light.png does not exist
* At _site/posts/text-and-typography/index.html:22:
internal image /posts/20190808/devtools-dark.png does not exist
For the Links check, the following failures were found:
* At _site/posts/customize-the-favicon/index.html:1:
'a' tag is missing a reference
* At _site/posts/getting-started/index.html:1:
'a' tag is missing a reference
* At _site/posts/text-and-typography/index.html:1:
'a' tag is missing a reference
* At _site/posts/try-write-a-demo-markdown/index.html:1:
'a' tag is missing a reference
* At _site/posts/write-a-new-post/index.html:1:
'a' tag is missing a reference
* At _site/posts/官方文档中英双译/index.html:1:
'a' tag is missing a reference
* At _site/posts/模板错误修正日志/index.html:1:
'a' tag is missing a reference
For the Links > Internal check, the following failures were found:
* At _site/posts/getting-started/index.html:9:
internally linking to /posts/20180809/pages-source-light.png, which does not exist
* At _site/posts/getting-started/index.html:9:
internally linking to /posts/20180809/pages-source-dark.png, which does not exist
* At _site/posts/text-and-typography/index.html:1:
internally linking to /commons/devices-mockup.png, which does not exist
* At _site/posts/text-and-typography/index.html:22:
internally linking to /posts/20190808/mockup.png, which does not exist
* At _site/posts/text-and-typography/index.html:22:
internally linking to /posts/20190808/mockup.png, which does not exist
* At _site/posts/text-and-typography/index.html:22:
internally linking to /posts/20190808/mockup.png, which does not exist
* At _site/posts/text-and-typography/index.html:22:
internally linking to /posts/20190808/mockup.png, which does not exist
* At _site/posts/text-and-typography/index.html:22:
internally linking to /posts/20190808/devtools-light.png, which does not exist
* At _site/posts/text-and-typography/index.html:22:
internally linking to /posts/20190808/devtools-dark.png, which does not exist
* At _site/posts/官方文档中英双译/index.html:139:
internally linking to #image-path; the file exists, but the hash 'image-path' does not
* At _site/posts/官方文档中英双译/index.html:139:
internally linking to #image-path; the file exists, but the hash 'image-path' does not
HTML-Proofer found 26 failures!
Error: Process completed with exit code 1.
原因:
文件中引用的图片和链接并不存在于你的站点中
改正
编写的文档里面的图片先放到本地,以后再升级放到腾讯云上 先把官方的四篇文档删掉,只留翻译过的
链接指向问题:
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
Running 3 checks (Scripts, Links, Images) in ["_site"] on *.html files...
Checking 65 internal links
Checking internal link hashes in 3 files
For the Links check, the following failures were found:
Ran on 19 files!
* At _site/posts/try-write-a-demo-markdown/index.html:1:
'a' tag is missing a reference
* At _site/posts/官方文档中英双译/index.html:1:
'a' tag is missing a reference
* At _site/posts/模板错误修正日志/index.html:1:
'a' tag is missing a reference
For the Links > Internal check, the following failures were found:
* At _site/posts/官方文档中英双译/index.html:139:
internally linking to #image-path; the file exists, but the hash 'image-path' does not
* At _site/posts/官方文档中英双译/index.html:139:
internally linking to #image-path; the file exists, but the hash 'image-path' does not
* At _site/posts/官方文档中英双译/index.html:153:
internally linking to /posts/text-and-typography/, which does not exist
HTML-Proofer found 6 failures!
Error: Process completed with exit code 1.
原因:
‘a’ tag is missing a reference 暂时不知道为啥,提交一下再看看 internally linking to #image-path; the file exists, but the hash ‘image-path’ does not 路径指向文件不存在 internally linking to /posts/text-and-typography/, which does not exist 路径指向文件不存在
改正
注释上错误的代码,并标注
htmlproofer问题:
关于本地运行可用但上传到GitHub Pages上之后运行报错
原因:
在工作流文件中有一段代码
1
2
3
4
5
6
- name: Test site
run: |
# bundle exec htmlproofer _site \
bundle exec htmlproofer --disable-all _site \
\-\-disable-external=true \
\-\-ignore-urls "/^http:\/\/127.0.0.1/,/^http:\/\/0.0.0.0/,/^http:\/\/localhost/"
其中这段代码表示使用开源的htmlproofer HTMLProofer 是一个用于测试 HTML 文件质量的工具。它用于检查 HTML 的图像引用是否合法、 是否有 alt 标签、内部链接是否有效等问题。
既然上面总报错’a’ tag is missing a reference 而且实际的使用中无伤大雅甚至没有太大卵用 大不了push之前先本地运行一遍自行检查html链接问题呗 那就注释掉喽 TMD卡了我好几周
改正
注释掉工作流文件中的Test site代码
总结
本文现阶段大部分问题来源于图片或a标签指向指向问题 稍后阶段会将实际笔记中使用到的图片上传到github上,也就是项目文件中 待之后时间充裕会将图片视频等资源上传到CDN上
本文由作者按照 CC BY 4.0 进行授权