Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

In certain cases, cant use '_' at new_post_name. #3862

Closed
5 tasks done
tetsuyainfra opened this issue Nov 16, 2019 · 2 comments
Closed
5 tasks done

In certain cases, cant use '_' at new_post_name. #3862

tetsuyainfra opened this issue Nov 16, 2019 · 2 comments
Labels
bug Something isn't working

Comments

@tetsuyainfra
Copy link

Check List

  • I have already read Docs page & Troubleshooting page
  • I have already searched existing issues and they are not help to me
  • I examined error or warning messages and it's difficult to solve
  • Using the latest version of Hexo (run hexo version to check)
  • Node.js is higher than 8.6.0

Expected behavior

`INFO Created: ~/work/jisaku-club/blog/source/_posts/2019-11-19_test.md

Actual behavior`

INFO Created: ~/work/jisaku-club/blog/source/_posts/2019-11-undefinedtest.md

How to reproduce?

  • Change _config.yaml as bellow
  • hexo new post test

Environment & Settings

Node.js & npm version

node v12.13.0
npm 6.13.0

Your site _config.yml (Optional)

new_post_name: ':year-:month-:day_:title.md' # File name of new posts

Hexo and Plugin version(npm ls --depth 0)

hexo-site@0.0.0 /home/tetsuyainfra/work/jisaku-club/blog
├── hexo@4.0.0
├── hexo-deployer-git@2.0.0
├── hexo-generator-archive@1.0.0
├── hexo-generator-category@1.0.0
├── hexo-generator-index@1.0.0
├── hexo-generator-tag@1.0.0
├── hexo-renderer-ejs@1.0.0
├── hexo-renderer-marked@2.0.0
├── hexo-renderer-stylus@1.1.0
└── hexo-server@1.0.0

Your package.json package.json

{                                                 
  "name": "hexo-site",                            
  "version": "0.0.0",                             
  "private": true,                                
  "scripts": {                                    
    "build": "hexo generate",                     
    "clean": "hexo clean",                        
    "deploy": "hexo deploy",                      
    "server": "hexo server"                       
  },                                              
  "hexo": {                                       
    "version": "4.0.0"                            
  },                                              
  "dependencies": {                               
    "hexo": "^4.0.0",                             
    "hexo-deployer-git": "^2.0.0",                
    "hexo-generator-archive": "^1.0.0",           
    "hexo-generator-category": "^1.0.0",          
    "hexo-generator-index": "^1.0.0",             
    "hexo-generator-tag": "^1.0.0",               
    "hexo-renderer-ejs": "^1.0.0",                
    "hexo-renderer-marked": "^2.0.0",             
    "hexo-renderer-stylus": "^1.1.0",             
    "hexo-server": "^1.0.0"                       
  }                                               
}                                                 

Others

When I followed the code, I found out that I could change regex key will be ok.
https://github.com/hexojs/hexo-util/blob/master/lib/permalink.js#L5

But present code, variable keys already include '_'.

const reservedKeys = {
year: true,
month: true,
i_month: true,
day: true,
i_day: true,
title: true
};

I thought I could use the current key to regular expression,
but it matter if the number of keys increases in the future.

I couldn't come up with a way to solve it.

@seaoak
Copy link
Member

seaoak commented Nov 21, 2019

@tetsuyainfra 's comment is right.
I think this behavior is a bug of hexo-util/lib/permalink.js.

I make a new patch hexojs/hexo-util#139.

@seaoak seaoak added bug Something isn't working and removed need-investigation labels Nov 21, 2019
@curbengh
Copy link
Contributor

curbengh commented Nov 22, 2019

Fix has been merged, please wait for its release in hexo-util 1.6.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants