Skip to content

Using page-specific data on layouts. #4651

Closed
@pauldotknopf

Description

It doesn't look like it's possible, but I just wanted to clarify.

I have a common layout for my pages. I'd like to hide/show components, add classes to body, etc, on this layout for specific pages.

For example, some front matter properties.

  1. showGutter: Add/remove body class that changes style a little.
  2. showMenu: Show or hide a common side menu.

I don't mind configuring these properties with the createPage.

createPage({
    ...
    context: {
        showGutter: true,
        showMenu: false
    }
});

Maybe there is some way to do what the helmet plugin does, using the onRenderBody method?

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