Skip to content

Reverse the lookup order of partials #8998

Closed
@rsolvang

Description

@rsolvang

I'm not sure if this is a bug or the intended behavior, but the current lookup order is that files (in the partials/ folder) are overriding inline partials. This behavior is a major hindrance in my pursuit of building a dynamic Theme Component (child theme).

A short summary of what I try to achieve: to make it possible to override parts of the Theme Component as needed, with great granularity. The code for my Theme Component can be viewed here: https://git.sr.ht/~rsolvang/cloudless-hugo-theme/tree/partials/item/layouts/_default/baseof.html

The solution would be to reverse the lookup order so that inline partials overrides partial files, not the other way around.

EDIT: Also see the discussion on the forum. @jmooring showed me that removing the suffix (.html) when calling and defining partials, fixed the issue. The question I have now is how much of a hack this is and if this behavior is at risk of changing in future versions of Hugo.

EDIT2: Seems like the workaround crashes Hugo in certain situations. Have a look at the thread in the forum for further details.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions