hexojs / hexo

A fast, simple & powerful blog framework, powered by Node.js.
https://hexo.io
MIT License
39.17k stars 4.81k forks source link

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

Open simonkimi opened 1 month ago

simonkimi commented 1 month ago

Check List

Expected behavior

I have articles in various formats, such as Markdown (.md) and AsciiDoc (.adoc). However, due to the code at this link, 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

node: v18.2.0
pnpm: 9.4.0

Your Hexo and Plugin version

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

{
  "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

simonkimi commented 1 month ago

I am wondering if there is a configuration for a whitelist or blacklist to distinguish which files are articles and which are asset files. For example: post_extension: ["md", "adoc"], and anything beyond this will be considered as asset files.

yoshinorin commented 1 month ago

@simonkimi

I am wondering if there is a configuration for a whitelist or blacklist to distinguish which files are articles and which are asset files. For example: post_extension: ["md", "adoc"], and anything beyond this will be considered as asset files.

As far as I know, there are none. I'm not sure what side effects there might be, but if you (or someone) submit a PR about this, we could be accepted.

uiolee commented 3 weeks ago

https://github.com/hexojs/hexo/pull/4781