Handle layout key in frontmatter
See original GitHub issueAfter 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:
- Created 6 years ago
- Reactions:1
- Comments:6 (5 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Regarding layout being a HOC vs normal component, I would currently prefer a HOC because it gives maximum flexibility on top level pages.
This functionality can now be supported with
export
syntax.