Skip to content

Passing Ruby types to parent layouts through content_for #53

Open
@moll

Description

@moll

Hey,

I was trying to set a class on the <body> of a parent layout from an intermediate layout. As variables set in a content_for :parent do foo = 42 end don't reach the parent layout, I ended up using the content_for string overload (content_for :class, "page-xyz" and querying it through content_for(@item, :class) in the parent layout). As it internally appends to some ERB/Haml buffer, this works for string variables.

How about generalizing it so one could pass all Ruby types through this mechanism?

This with Nanoc v4.10.1.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions