Skip to content

lazyimg partials not found on Hugo ≥ 0.146 due to “partials/” prefix #11

Description

@matharel

Description

Since Hugo v0.146, partial lookups no longer support the old “double lookup” behavior when you call {{ partial "partials/foo" . }}. The lazyimg module’s vendored partials (e.g. layouts/partials/lazyimg-setup-nojs.html) still use:

{{ partial "partials/lazyimg-setup" . }}

and so Hugo cannot find them, resulting in errors like:

error calling partial: partial "partials/lazyimg-setup" not found

Steps to Reproduce

  1. Start a Hugo site (with modules enabled) on Hugo v0.146 or later.
  2. In your config.*, import the module:
[[module.imports]]
path = "github.com/hugo-mods/lazyimg"
  1. hugo mod tidy && hugo mod vendor
  2. In your theme’s baseof.html, include lazyimg:
    {{ partial "lazyimg-setup-nojs" . }}
  1. Run hugo server and attempt to build any page that renders images.

Actual Behavior

Hugo fails with:

ERROR render of “…/lazyimg-setup-nojs.html”: error calling partial: partial "partials/lazyimg-setup" not found

Expected Behavior

The module’s partials should work out of the box on Hugo v0.146+ without manual patching.

Environment

  • Hugo version: 0.146 (and later)
  • Go Modules enabled (module.imports in config, go.mod present)
  • Lazyimg version: latest via hugo mod get github.com/hugo-mods/lazyimg
  • Theme scenario: vendored under themes/seb-doc/_vendor/...

Workaround

Remove the partials/ prefix in the vendored partial names, e.g. change in

_vendor/github.com/hugo-mods/lazyimg/layouts/partials/lazyimg-setup-nojs.html:
- {{ partial "partials/lazyimg-setup" . }}
+ {{ partial "lazyimg-setup" . }}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions