Hexo: asset files were rendered when post_asset_folder set to true

Created on 8 Sep 2015  ·  9Comments  ·  Source: hexojs/hexo

This is the source structure:

$ tree source/_posts/

source/_posts/
|-- hello-world.md
|-- test-post
|   |-- test_css.css
|   `-- test_js.js
`-- test-post.md

but when I executed hexo generate, the post in public folder looks like this:

$ tree public/2015/09/08/test-post/

public/2015/09/08/test-post/
|-- index.html
|-- test_css
|   `-- index.html
|-- test_css.css
|-- test_js
|   `-- index.html
`-- test_js.js

It seems the css files and javascript files also were rendered.

bug duplicate post-asset

Most helpful comment

Any progress? I think post_asset_folder flag should make renderer ignore the "asset_folder" completely, allowing only "asset" reference. Isn't this a core functionality?
This issue is still present in 3.7.1

All 9 comments

Confirmed this is happening. I'm using hexo version 3.1.1 .
This creation of additional index.html files and rendering them as if they were posts is occurring with css and js files in the asset folder, but not with jpg files.

I am suffering from this too with v3.1.1 also with v3.2.0-beta.2.

試試這配置:

skip_render:
- _posts/test-post/*

skip_render 的path 是相對source/

1591, https://github.com/hexojs/hexo/issues/1146#issuecomment-88380140

我就是这么输的

skip_render:
- _posts/test-post/*

貌似只要是_posts中的 js、css文件就不能skip掉

我看了下代码 https://github.com/hexojs/hexo/blob/8f35f1500496d8af2630cdd66e47880132e20300/lib/plugins/processor/post.js#L240

这里即使第一个判断 renderable 为 false, 只要设了 post_asset_folder 就会处理这个文件

try this:

skip_render:
- _posts/test-post/*
- _posts/test-post/*.js
- _posts/test-post/*.css

配置成这样是可以的

skip_render:
  - _posts/**/*.js
  - _posts/**/*.css

I have the same issue. It becomes the most annoying issue for me now. I have html files in the asset folder. Hexo renders them. I try js files. Hexo renders them. skipping render doesn't work.

The tag for the issue is weird. "duplicate" and "need-verify" are not suitable for this situation.

Any progress? I think post_asset_folder flag should make renderer ignore the "asset_folder" completely, allowing only "asset" reference. Isn't this a core functionality?
This issue is still present in 3.7.1

Any progress?

Was this page helpful?
0 / 5 - 0 ratings