hexojs / hexojs/hexo

After Enabling "post_asset_folder: true", Only One Format of Posts Can Be Rendered

Open
#5,523 3 comments 0 reactions 0 assignees View on GitHub
feature-request
Dominant language
TypeScript
Stars
41.8k
Forks
41
PR merge metrics
No merged PRs in 30d

Description

### Check List

- [X] I have already read [Docs page](https://hexo.io/docs/) & [Troubleshooting page](https://hexo.io/docs/troubleshooting).
- [X] I have already searched existing issues and they are not help to me.
- [X] I examined error or warning messages and it's difficult to solve.
- [X] I am using the [latest](https://github.com/hexojs/hexo/releases) version of Hexo. (run `hexo version` to check)
- [X] My Node.js is matched [the required version](https://hexo.io/docs/#Required-Node-js-version).

### Expected behavior

I have articles in various formats, such as Markdown (.md) and AsciiDoc (.adoc). However, due to the code at [this link](https://github.com/hexojs/hexo/blob/439ee6d19ead7973048b61f896437c30803cf17a/lib/plugins/processor/post.ts#L53), when the post_asset_folder is enabled, only articles with the same extension as defined in new_post_name can be rendered. Other types of documents are treated as asset files and ignored. I want articles with different file extensions to be rendered correctly.

### Actual behavior

My new_post_name setting is "year:month:day-:title.md", so only Markdown articles with the .md format are rendered, while other articles are ignored.

### How to reproduce?

1. Enable post_asset_folder
2. Create articles with different file extensions
3. hexo g

### Is the problem still there under `Safe mode`?

yes

### Your Node.js & npm version

```text
node: v18.2.0
pnpm: 9.4.0
```

### Your Hexo and Plugin version

```text
dependencies:
hexo 7.3.0 hexo-generator-archive 2.0.0 hexo-generator-tag 2.0.0 hexo-renderer-marked 6.3.0
hexo-asset-img 1.1.0 hexo-generator-category 2.0.0 hexo-renderer-asciidoc 2.2.0-dev.1 hexo-renderer-stylus 3.0.1
hexo-deployer-git 4.0.0 hexo-generator-index 3.0.0 hexo-renderer-ejs 2.0.0 hexo-server 3.0.0
```

### Your `package.json`

```json
{
"name": "hexo-site",
"version": "0.0.0",
"private": true,
"scripts": {
"build": "hexo clean && hexo generate --debug",
"clean": "hexo clean",
"deploy": "hexo deploy",
"server": "hexo server"
},
"hexo": {
"version": "7.3.0"
},
"dependencies": {
"hexo": "^7.3.0",
"hexo-asset-img": "^1.1.0",
"hexo-deployer-git": "^4.0.0",
"hexo-generator-archive": "^2.0.0",
"hexo-generator-category": "^2.0.0",
"hexo-generator-index": "^3.0.0",
"hexo-generator-tag": "^2.0.0",
"hexo-renderer-asciidoc": "2.2.0-dev.1",
"hexo-renderer-ejs": "^2.0.0",
"hexo-renderer-marked": "^6.3.0",
"hexo-renderer-stylus": "^3.0.0",
"hexo-server": "^3.0.0"
}
}
```

### Your site's `_config.yml` (Optional)

_No response_

### Others

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.