File tree Expand file tree Collapse file tree 4 files changed +30
-3
lines changed
Expand file tree Collapse file tree 4 files changed +30
-3
lines changed Original file line number Diff line number Diff line change 11import { html } from 'uhtml-isomorphic'
22
33export default async function JSPage ( {
4- siteName,
5- title,
4+ vars : {
5+ siteName,
6+ title,
7+ }
68} ) {
79 return html `
8- < p > The js page is the only page type that can render the body with the set varibles .</ p >
10+ < p > The js page is the only page type that can render the body with the set variables .</ p >
911
1012 < p >
1113 All you have to do is export a default function (async or sync) that returns a string, or any
Original file line number Diff line number Diff line change 1+ export default {
2+ layout : 'child'
3+ }
Original file line number Diff line number Diff line change 1+ import { html } from 'uhtml-isomorphic'
2+
3+ import defaultRootLayout from './root.layout.js'
4+
5+ export default function articleLayout ( args ) {
6+ const { children, ...rest } = args
7+ const wrappedChildren = html `
8+ < article class ="bc-article h-entry " itemscope itemtype ="http://schema.org/NewsArticle ">
9+
10+ < h1 > ${ rest . vars . title } </ h1 >
11+
12+ < section class ="e-content " itemprop ="articleBody ">
13+ ${ typeof children === 'string'
14+ ? html ( [ children ] )
15+ : children /* Support both uhtml and string children. Optional. */
16+ }
17+ </ section >
18+ </ article >
19+ `
20+
21+ return defaultRootLayout ( { children : wrappedChildren , ...rest } )
22+ }
File renamed without changes.
You can’t perform that action at this time.
0 commit comments