Skip to content

Search Template Props Discrepancy #3

@matthewbrutonall

Description

@matthewbrutonall

Summary

There is a discrepancy between the expected props in custom search templates (content/search/_result.mdx) and what is
actually passed by the runtime. Templates attempting to access props.result (as seen in previous patterns or examples) fail
because the data is passed as props.record.

Details

Expected: props.result.title, props.result.href, etc.
Actual: props.record.title, props.record.href, etc.

Impact

Users creating custom search result layouts encounter TypeError: Cannot read properties of undefined when trying to
access props.result.

Recommendation

Update the documentation and default templates to clearly specify that the search result object is passed as record, or map the prop to result for backward compatibility

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions