page.js
. Copy the contents of post.js
into page.js
and rename the component from <Post>
to <Page>
. Remember to also change the export
line - line 18 in the code sample below.data.type
rather than hard code post
, because in this case the type will be page
.page.js
and post.js
are pretty much identical, so let's now distinguish between them by adding author and date info to post.js
.frontity.state.source.post[60]
, we can see that the only information we have about the author is the ID.state.source.author[ID]
.<Post>
component in post.js
to get the author information and display both it and the post date.<Page>
component, and then use it in the <Switch>
component to conditionally render it if data.isPage
is true.