mirror of
https://github.com/mastermindzh/rickvanlieshout.com
synced 2024-12-25 22:39:41 +01:00
Fix preview templates
This commit is contained in:
parent
0338cd2844
commit
bd0677dfd3
@ -2,5 +2,5 @@ import CMS from 'netlify-cms';
|
||||
import PagePreview from './preview-templates/page-preview';
|
||||
import PostPreview from './preview-templates/post-preview';
|
||||
|
||||
CMS.registerPreviewTemplate('page', PagePreview);
|
||||
CMS.registerPreviewTemplate('post', PostPreview);
|
||||
CMS.registerPreviewTemplate('pages', PagePreview);
|
||||
CMS.registerPreviewTemplate('posts', PostPreview);
|
||||
|
@ -1,14 +1,14 @@
|
||||
import React from 'react';
|
||||
import { Page } from '../../components/Page';
|
||||
|
||||
const PagePreview = ({ entry, widgetFor }) => {
|
||||
const body = widgetFor(['body']);
|
||||
const title = entry.getIn(['data', 'title']);
|
||||
|
||||
return (
|
||||
<Page title={title}>
|
||||
<div dangerouslySetInnerHTML={{ __html: body }} />
|
||||
</Page>
|
||||
<div className="page">
|
||||
<h1 className="page__title">{title}</h1>
|
||||
<div className="page__body" dangerouslySetInnerHTML={{ __html: body }} />
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
|
@ -1,12 +1,14 @@
|
||||
import React from 'react';
|
||||
import { Content } from '../../components/Post/Content';
|
||||
|
||||
const PostPreview = ({ entry, widgetFor }) => {
|
||||
const body = widgetFor(['body']);
|
||||
const title = entry.getIn(['data', 'title']);
|
||||
|
||||
return (
|
||||
<Content body={body} title={title} />
|
||||
<div className="post">
|
||||
<h1 className="post__title">{title}</h1>
|
||||
<div className="post__body" dangerouslySetInnerHTML={{ __html: body }} />
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user