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

fix(#4236): don't create "<page>/index" directories when post_asset_folder is true #4258

Merged
merged 4 commits into from
Jun 5, 2020

Conversation

jiangtj
Copy link
Member

@jiangtj jiangtj commented Apr 22, 2020

What does it do?

fix #4236

How to test

git clone -b fix-post-asset-folder https://github.com/jiangtj/hexo.git
cd hexo
npm install
npm test

Pull request tasks

  • Add test cases for the changes.
  • Passed the CI test.

@SukkaW
Copy link
Member

SukkaW commented Apr 22, 2020

Why shouldn't page has asset_folder then?

Considering the case:

├─source
│  ├─example-page.md (whose "permalink" is set to "/example-page/")
│  ├─example-page
│  │  ├─some-pic.png

@jiangtj
Copy link
Member Author

jiangtj commented Apr 23, 2020

In fact, the hexo new command only has these variables and cannot set permalink

console.register('new', 'Create a new post.', {
usage: '[layout] <title>',
arguments: [
{name: 'layout', desc: 'Post layout. Use post, page, draft or whatever you want.'},
{name: 'title', desc: 'Post title. Wrap it with quotations to escape.'}
],
options: [
{name: '-r, --replace', desc: 'Replace the current post if existed.'},
{name: '-s, --slug', desc: 'Post slug. Customize the URL of the post.'},
{name: '-p, --path', desc: 'Post path. Customize the path of the post.'}
]
}, require('./new'));

So when we execute the hexo new page (layout is page), we will get the following result

├─source
│  ├─example-page
│  │  ├─index.md
│  │  ├─index(The current master will create this directory, but for `index.md`, this `example-page` is the resource directory, not `example-page/index`)

I tried using hexo new page example-page -p example-page and got the same path as in your example, I may need to modify the source code to filter out the path suffix /index.md, not all pages

@jiangtj
Copy link
Member Author

jiangtj commented Apr 23, 2020

I encountered a serious problem, the test case is perfect to run locally, but the error is reported on ci. . .

Forgot to synchronize the upstream/master

Copy link
Member

@SukkaW SukkaW left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@SukkaW SukkaW merged commit a62a810 into hexojs:master Jun 5, 2020
@SukkaW SukkaW mentioned this pull request Jul 25, 2020
22 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Images in Page "index" directories don't work like normal post_asset_folder's
2 participants