Skip to content

Allow computed data to configure special Eleventy Data properties (like pagination) #1110

@romaricpascal

Description

@romaricpascal

Describe the bug
I'm trying to paginate some data that's returned by an eleventyComputed property. Eleventy breaks announcing it cannot find the property used for the pagination:

Could not resolve pagination key in template data: supportedLocales

To Reproduce

The computed-properties-pagination branch of this repository contains a reduced test case. The test.liquid template tries to paginate over the supportedLocales key defined in data/eleventyComputed. Run npx @11ty/eleventy to get the exception.

If there's a non-computed property with the same name, it will get used for the pagination. You can witness the behaviour using the previous commit on the branch. It contains a property with the same key defined in data/supportedLocales. The test.liquid template does paginate, but does it over the "static" properties not the computed ones.

Expected behavior

I'd have expected the computed property to be used for pagination in both cases, overriding the static ones when they are defined.

Environment:

  • OS and Version: Ubuntu 18.04
  • Eleventy Version: Using the 11ty/eleventy#9109e76 in package.json.

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    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