From 8fe56e0b34eac47b92be6cc99ca95c67eaf0affc Mon Sep 17 00:00:00 2001 From: Patryk Niedźwiedziński Date: Mon, 3 Feb 2020 19:38:24 +0100 Subject: Netlify cms (#7) * Add netlify CMS * Add netlify.toml * Add example media library * Add Netlify Identity * Fix post path * Add content * Add body * Fix date format * Add site url * Add image * Disable editorial workflow * Add date path * Add file extension * Use the latest release * Fix slug * Filename on preview path * Remove filenames --- .gitignore | 2 +- netlify.toml | 3 +++ static/admin/config.yml | 56 +++++++++++++++++++++++++++++++++++++++++++++++++ static/admin/index.html | 21 +++++++++++++++++++ test/build.js | 2 +- test/package.json | 2 +- 6 files changed, 83 insertions(+), 3 deletions(-) create mode 100644 netlify.toml create mode 100644 static/admin/config.yml create mode 100644 static/admin/index.html diff --git a/.gitignore b/.gitignore index f5c3e7a..62eeeb8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,5 @@ .DS_Store -api +static/api # testing node_modules diff --git a/netlify.toml b/netlify.toml new file mode 100644 index 0000000..e4d318a --- /dev/null +++ b/netlify.toml @@ -0,0 +1,3 @@ +[build] + publish = "static" + command = "cd test && npm install && npm run build" diff --git a/static/admin/config.yml b/static/admin/config.yml new file mode 100644 index 0000000..2d710c0 --- /dev/null +++ b/static/admin/config.yml @@ -0,0 +1,56 @@ +backend: + name: git-gateway + +#publish_mode: editorial_workflow +display_url: https://puszcza.netlify.com +site_url: https://puszcza.netlify.com +locale: 'pl' + +media_folder: 'static/media' +media_library: + name: uploadcare + config: + publicKey: demopublickey + +collections: + - name: posts + label: 'Wpisy' + folder: 'wpisy' + slug: '{{title}}' + path: '{{year}}/{{month}}/{{day}}/{{slug}}' + preview_path: 'kronika/{{year}}/{{month}}/{{day}}/{{title}}' + preview_path_date_field: 'date' + editor: + preview: false + fields: + - label: 'Tytuł' + name: title + widget: string + required: true + + - label: 'Autor' + name: author + widget: string + required: true + + - label: 'Data' + name: date + widget: datetime + dateFormat: DD.MM.YYYY + timeFormat: false + required: true + + - label: 'Kategorie/Tagi' + name: category + widget: list + required: false + + - label: 'Zdjęcie okładki - link' + name: image + widget: string + required: false + + - label: 'Wpis' + name: body + widget: markdown + required: true diff --git a/static/admin/index.html b/static/admin/index.html new file mode 100644 index 0000000..79adafc --- /dev/null +++ b/static/admin/index.html @@ -0,0 +1,21 @@ + + + + + Netlify CMS + + + + + + + + + + diff --git a/test/build.js b/test/build.js index c5b6e8c..036fc69 100644 --- a/test/build.js +++ b/test/build.js @@ -2,4 +2,4 @@ import Kronikarz from 'kronikarz'; const k = new Kronikarz('../wpisy'); -k.generateApi('../api'); +k.generateApi('../static'); diff --git a/test/package.json b/test/package.json index 74665d2..c98d7e9 100644 --- a/test/package.json +++ b/test/package.json @@ -8,7 +8,7 @@ "kronikarz": "^2.0.0" }, "scripts": { - "build": "mkdir -p ../api/api && touch ../api/api/posts.json && node -r esm build.js && cp _headers ../api", + "build": "mkdir -p ../static/api && touch ../static/api/posts.json && node -r esm build.js && cp _headers ../static", "test": "./validator.sh" }, "keywords": [], -- cgit 1.4.1