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

Partials should be relative to views, not dirname(path) #112

Closed
wants to merge 1 commit into from

Conversation

blented
Copy link

@blented blented commented May 8, 2013

Partials are currently read relative to the dirname of the template
you're rendering, not the views directory. This means that when you're
rendering views/subfolder/page the partials in views/partials won't
load correctly.

Partials are currently read relative to the dirname of the template
you're rendering, not the views directory.  This means that when you're
rendering views/subfolder/page  the partials in views/partials won't
load correctly.
@simov
Copy link
Contributor

simov commented May 8, 2013

I personally always render base.html which is at the root i.e. views/base.html. I think something similar was asked in one of the previous issues.
I think if we accept your way someone else may ask to have them relative to the rendered template.

@blented
Copy link
Author

blented commented May 8, 2013

Just seems like you set a views folder as the "root" for a reason, so the partials should use that same "root", not be relative to whatever file you're sending.

The trouble comes w/ template inheritance, which I'm doing in Hogan:

views/layouts/default.html

{{$content}}{{/content}}

views/backend/base.html -> extends default
{{<default}}
{{$content}}Site backend{{/content}}
{{/defualt}}

So when I render 'backend/base' with consolidate, the basic layout partials don't load properly because they're relative to 'views/backend' not 'views/'

@simov
Copy link
Contributor

simov commented May 8, 2013

Yes I understand your problem, my point was that someone else may expect the partials paths to be relative to the rendered template. The same is true if you want your partials to have absolute paths for some reason.
I think this should be implemented as an option somehow to prevent future inconveniences.

@doowb
Copy link
Collaborator

doowb commented Sep 17, 2017

Closing in favor of #86

@doowb doowb closed this Sep 17, 2017
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.

3 participants