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

block templates can not be overridden on their own #2783

Closed
ebr opened this issue Dec 13, 2016 · 1 comment · Fixed by #2792
Closed

block templates can not be overridden on their own #2783

ebr opened this issue Dec 13, 2016 · 1 comment · Fixed by #2792
Assignees
Milestone

Comments

@ebr
Copy link
Contributor

ebr commented Dec 13, 2016

Relevant discussion here: https://discuss.gohugo.io/t/block-templates-outside-of-a-theme/4806
Repro case here: https://github.com/ebr/hugo-example

Summary:

templates that use blocks (e.g. baseof.html) cannot be overridden on their own. They require the sub-templates (ones that define blocks) to be also present in the project.

Steps to reproduce:

  • create a theme using block templates, e.g ./theme/layouts/_default/baseof.html, ./theme/layouts/index.html, where index.html defines a block that is used in baseof.html
  • copy baseof.html to ./layouts/_default/ (out of the theme and up into the project)
  • delete baseof.html in the theme

Result:

  • rendered index.html is blank. the base template isn't finding the index.html block template.

Expected:

  • baseof.html should use the relevant template from the theme.

Version:

Hugo 0.18-DEV

@bep bep self-assigned this Dec 14, 2016
@bep bep added this to the v0.18 milestone Dec 15, 2016
bep added a commit to bep/hugo that referenced this issue Dec 15, 2016
This commit fixes the base template lookup order to match the behaviour of regular templates.

```
1. <current-path>/<template-name>-baseof.<suffix>, e.g. list-baseof.<suffix>.
2. <current-path>/baseof.<suffix>
3. _default/<template-name>-baseof.<suffix>, e.g. list-baseof.<suffix>.
4. _default/baseof.<suffix>

For each of the steps above, it will first look in the project, then, if theme is set,
in the theme's layouts folder.
```

Fixes gohugoio#2783
@bep bep closed this as completed in #2792 Dec 15, 2016
bep added a commit that referenced this issue Dec 15, 2016
This commit fixes the base template lookup order to match the behaviour of regular templates.

```
1. <current-path>/<template-name>-baseof.<suffix>, e.g. list-baseof.<suffix>.
2. <current-path>/baseof.<suffix>
3. _default/<template-name>-baseof.<suffix>, e.g. list-baseof.<suffix>.
4. _default/baseof.<suffix>

For each of the steps above, it will first look in the project, then, if theme is set,
in the theme's layouts folder.
```

Fixes #2783
bep added a commit to bep/hugo that referenced this issue Dec 15, 2016
@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 30, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants