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

Strange error on partial in baseof.html #5373

Closed
ikemo3 opened this Issue Oct 29, 2018 · 3 comments

Comments

Projects
None yet
2 participants
@ikemo3

ikemo3 commented Oct 29, 2018

Steps to reproduce

I made example repository to reproduce error.
https://github.com/ikemo3/hugo-baseof-partial

git clone https://github.com/ikemo3/hugo-baseof-partial
cd hugo-baseof-partial
git checkout error
hugo

if {{ partial "baseof.body" . }} is in baseof.html, this error occured.
if {{ partial "body" . }} is in baseof.html, this error not occured.
(master branch in the example repository).

Actual Results

Error: Error building site: "/Users/ikemo/hugo-baseof-partial/layouts/_default/baseof.html:7:5": execute of template failed: template: 404.html:7:5: executing "404.html" at <partial "baseof.body...>: error calling partial: Partial "baseof.body" not found

Expected Results

No error.

Version

Hugo Static Site Generator v0.50/extended darwin/amd64 BuildDate: unknown
installed by Homebrew.

@bep

This comment has been minimized.

Member

bep commented Oct 31, 2018

We currently use "baseof" as an identifier to identify ... base templates. Those are handled specially. I picked "baseof" as a very distinctive name thinking no-one would ever think of calling their other templates that. I could probably add additional checks here, but this is not a priority for me. For now: Consider baseof.* to be reserved for base templates.

ikemo3 added a commit to ikemo3/hugoDocs that referenced this issue Nov 1, 2018

@ikemo3

This comment has been minimized.

ikemo3 commented Nov 1, 2018

For now: Consider baseof.* to be reserved for base templates.

This is no problem.
But I was confused by this error, so I would like to update the document.

bep added a commit to gohugoio/hugoDocs that referenced this issue Nov 1, 2018

@ikemo3

This comment has been minimized.

ikemo3 commented Nov 2, 2018

I tried reading source code.
(I am a newbie at golang)

In tpl/tplimpl/template.go, isBaseTemplate uses strings.Contains.
Therefore, it seems that partial including baseof can not be used.

I will close this ticket and send a document correction.

@ikemo3 ikemo3 closed this Nov 2, 2018

ikemo3 added a commit to ikemo3/hugoDocs that referenced this issue Nov 2, 2018

bep added a commit to gohugoio/hugoDocs that referenced this issue Nov 2, 2018

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