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 · 0 comments

Comments

Projects
None yet
2 participants
@ebr
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 added Enhancement Bug and removed Enhancement labels Dec 13, 2016

@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

hugolib: Enable override of theme base template only
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 bep closed this in #2792 Dec 15, 2016

bep added a commit that referenced this issue Dec 15, 2016

hugolib: Enable override of theme base template only
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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment