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

partial不支持向上级目录查找,绝对路径也不可以使用 #819

Closed
dnxbf321 opened this issue Aug 29, 2014 · 7 comments
Closed
Labels
bug Something isn't working

Comments

@dnxbf321
Copy link

|- A
|----a.ejs
|-B
|----b.ejs

当前在a.ejs处,partial('../B/b')不能获取b.ejs

@tommy351
Copy link
Member

Use absolute path instead.

<%- partial('B/b') %>

@dnxbf321
Copy link
Author

1

我的目录结构是这样的,在post.ejs中
<%- partial('_partial/article', {post: page, isHome: false}) %> 正确
<%- partial('../layout/_partial/article', {post: page, isHome: false}) %> 不可以
按理来说应当第二种也应该可以???

2

@tommy351
Copy link
Member

The following is how Hexo resolves template path:

var layoutView = this.theme.getView(pathFn.join(pathFn.dirname(this.path), name));

this.theme.getView(pathFn.join(pathFn.dirname(this.path), name));

In your situation, this.path is <blah blah>/themes/greeneye/post.ejs. So the template path is resolved like this:

pathFn.dirname(this.path) => '/themes/greeneye'
pathFn.join(dirname, '../layout/_partial_article') => '/themes/layout/_partial/article'

I'll try to fix this bug later.

@tommy351 tommy351 added the bug label Aug 29, 2014
@tommy351 tommy351 added this to the 2.9 milestone Aug 29, 2014
@tommy351 tommy351 modified the milestones: 2.9, 3.0 Jan 26, 2015
@Xuanwo
Copy link
Contributor

Xuanwo commented Jun 8, 2015

Fiexed?

@Xuanwo
Copy link
Contributor

Xuanwo commented Dec 10, 2015

@tommy351 Had this fixed?

@NoahDragon NoahDragon modified the milestones: 4.0, 3.0 Apr 6, 2017
@NoahDragon NoahDragon mentioned this issue Apr 6, 2017
53 tasks
@stevenjoezhang
Copy link
Member

Fixed in Hexo v3.x

@yoshinorin
Copy link
Member

@stevenjoezhang
Thanks :)
As you say this issue already fixed.

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

6 participants