question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Handle layout key in frontmatter

See original GitHub issue

After some discussion with @timneutkens and @jxnblk we think it makes most sense to allow layout to be optionally specified in frontmatter.

---
title: Awesome Page
slug: /awesome
layout: ./PageLayout
team:
  - jxn
  - mrmrs
  - johno
---

Resulting in, when layout is defined, the result would be something similar to:

import PageLayout from './PageLayout'

// ... stuff

export default PostLayout(frontmatter)(Markdown)

Something to consider: Should a layout be a HOC or standard component?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
timneutkenscommented, Mar 6, 2018

Regarding layout being a HOC vs normal component, I would currently prefer a HOC because it gives maximum flexibility on top level pages.

0reactions
johnocommented, Mar 12, 2018

This functionality can now be supported with export syntax.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Front Matter - Hugo
a map of Front Matter keys whose values are passed down to the page's descendants unless overwritten by self or a closer ancestor's...
Read more >
YAML Front Matter not attached to page in layout #4246 - GitHub
I'm not sure how to check for non-nil, non-empty string, and check that the hash has the key body_class all at once in...
Read more >
4. Introduction to front matter - Learn | CloudCannon
Front matter is used to set variables and metadata on pages in your Jekyll site. Basics. We'll start with some basic HTML structure...
Read more >
Lesson 4: Front matter basics | Learn Eleventy From Scratch
Front Matter is like metadata for your page or template. It's generally powered by YAML ... Our existing Front Matter contains a title...
Read more >
Customize Front Matter Parsing — Eleventy
If you want the excerpt to be separate from the content, make a new key for this and store it separately in your...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found