Skip to content

Commit

Permalink
fix(admin): fix netlify cms config
Browse files Browse the repository at this point in the history
  • Loading branch information
lukeocodes committed Nov 9, 2020
1 parent 9b77a63 commit 38ed05e
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
17 changes: 17 additions & 0 deletions static/admin/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,22 @@
<body>
<!-- Include the script that builds the page and powers Netlify CMS -->
<script src="https://unpkg.com/netlify-cms@^2.0.0/dist/netlify-cms.js"></script>
<script>
var PostPreview = createClass({
render: function() {
var entry = this.props.entry;
var featuredimage = entry.getIn(['data', 'featuredimage']);
var image = this.props.getAsset(featuredimage);
return h('div', {},
h('h1', {}, entry.getIn(['data', 'title'])),
h('img', {src: image.toString()}),
h('div', {"className": "text"}, this.props.widgetFor('body'))
);
}
});

CMS.registerPreviewStyle("netlify-preview.css");
CMS.registerPreviewTemplate("blog", PostPreview);
</script>
</body>
</html>
16 changes: 16 additions & 0 deletions static/admin/netlify-preview.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
html,
body {
color: #444;
font-size: 14px;
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

body {
padding: 20px;
}

img {
max-width: 100vw;
max-height: 50vw;
margin: 20px 0;
}

0 comments on commit 38ed05e

Please # to comment.