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

Strange error on partial in baseof.html #5373

Closed
ikemo3 opened this issue Oct 29, 2018 · 4 comments
Closed

Strange error on partial in baseof.html #5373

ikemo3 opened this issue Oct 29, 2018 · 4 comments
Labels

Comments

@ikemo3
Copy link

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
Copy link
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
Copy link
Author

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.

@ikemo3
Copy link
Author

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 as completed Nov 2, 2018
bep pushed a commit to gohugoio/hugoDocs that referenced this issue Nov 2, 2018
@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 Feb 24, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants