When using _config.[theme].yml within the Hexo directory, theoretically, when using each to iterate over an array in YAML, it should only retrieve the values from _config.[theme].yml.
In actual output, the values from both _config.[theme].yml and _config.yml in the theme will be output together when iterating over the array. This means that both values are included in the final output.
When using _config.[theme].yml within the Hexo directory, theoretically, the priority of this configuration file should be higher than the _config.yml in the theme. However, when developing a Pug theme, the iteration will read both _config.[theme].yml in the Hexo directory and _config.yml in the theme directory together.
Here is the specific code:
====
hexo > _config.[theme].yml
test:
- a
- b
- c
theme > _config.yml
test:
- d
- e
- f
pug
each item, index in theme.test
=item
br
html
a
<br />
b
<br />
c
<br />
d
<br />
e
<br />
f
<br />
Check List
Please check followings before submitting a new issue.
hexo version
to check)Expected behavior
原文:
当在 hexo 目录内使用
_config.[theme].yml
时,理论上使用 each 遍历 YAML 的数组时只会获取到_config.[theme].yml
的值。====
translate:
When using
_config.[theme].yml
within the Hexo directory, theoretically, when usingeach
to iterate over an array in YAML, it should only retrieve the values from_config.[theme].yml
.Actual behavior
原文:
实际输出数组时会连同主题的
_config.yml
值一起输出,等于是输出了_config.[theme].yml
和主题内的_config.yml
两个值总输出。====
translate:
In actual output, the values from both
_config.[theme].yml
and_config.yml
in the theme will be output together when iterating over the array. This means that both values are included in the final output.How to reproduce?
原文:
当在 hexo 目录内使用
_config.[theme].yml
时,理论上此配置文件的优先级会高于主题里的_config.yml
,我在使用 pug 开发主题时,使用遍历会把 hexo 目录内的_config.[theme].yml
和主题目录内的_config.yml
配置一起读取。具体代码如下:
====
translate:
When using _config.[theme].yml within the Hexo directory, theoretically, the priority of this configuration file should be higher than the _config.yml in the theme. However, when developing a Pug theme, the iteration will read both _config.[theme].yml in the Hexo directory and _config.yml in the theme directory together.
Here is the specific code:
====
hexo
>_config.[theme].yml
theme
>_config.yml
pug
html
Is the problem still there under "Safe mode"?
我尝试过使用命令进入安全模式,由于没学习 js ,网上也找不到相关的教程教我如何使用安全模式,摸索了半天之后,放弃了安全模式。
Environment & Settings
Node.js & npm version(
node -v && npm -v
)Your site
_config.yml
(Optional)Hexo and Plugin version(
npm ls --depth 0
)Your package.json
package.json
Others
原文:
我尝试过在全新的 hexo 里去测试,依旧会存在此问题。
但是,不管是新的 hexo 环境,还是在原来的 hexo 里,使用有指定项的数组,都不会出现此问题。
具体请看以下示例:
====
translate:
I have tried testing this issue in a fresh Hexo environment, and the problem still persists.
However, whether it is in a new Hexo environment or the existing one, when using an array with specified items, the issue does not occur.
Please refer to the following example for more details:
====
hexo
>_config.[theme].yml
theme
>_config.yml
pug
html