Last Modified: Wednesday, Feb 13, 2019
Not going to detail everything, the documentation isn’t bad.
Gotchas
As of now (3/23/19), you cannot access the CMS locally from what I can tell. It pulls from GitHub, not local (and even then it looks like it has to be a Netlify build, not just a commit)
Make sure to create hidden fields that autofill the Params listed in the matching archetype.
Make sure to provide descriptive Labels & hints for your clients.
Example Config.yml
Example index.html
Conditional Rendering reference: https://www.robinwieruch.de/conditional-rendering-react/
Be aware that conditional rendering works differently for regular items and lists/objects.
Regular: variable || ""
List/Object: variable.getIn(["data"]) && render
Setup
No longer put the index.html in /static/admin, must put it in src/netlify-cms with the following webpack.prod.js
npm i webpack-file-changer
webpack.prod.js
const path = require("path");
const fileChanger = require('webpack-file-changer');
...
new MiniCssExtractPlugin({
filename: "[name].[hash].css",
chunkFilename: "[id].[hash].css"
}),
...
plugins: [
new fileChanger({
move: [{
from: path.resolve(__dirname, "src/netlify-cms", 'index.html'),
to: 'dist/admin/index.html',
parameters: {
'main\\.css': 'main.[hash].css'
},
before: function(stats, move) {
},
after: function(stats, move) {
}
}],
complete: function(stats) {
}
})
]