Update 02.10.2020

This commit is contained in:
Denys Konovalov 2020-10-02 15:25:35 +02:00
parent 37e87d649b
commit 1038eb84ee
2 changed files with 26 additions and 2 deletions

@ -261,6 +261,8 @@ collections:
create: true create: true
#editor: #editor:
#preview: false #preview: false
media_folder: '/static/media/schulchronik'
public_folder: '/media/schulchronik'
fields: fields:
- {label: "Titel", name: "title", widget: "string"} - {label: "Titel", name: "title", widget: "string"}
- {label: "Entwurf", name: "draft", widget: "boolean", default: "false", required: false} - {label: "Entwurf", name: "draft", widget: "boolean", default: "false", required: false}
@ -275,6 +277,8 @@ collections:
create: true create: true
editor: editor:
preview: false preview: false
media_folder: '/static/media/abiturienten'
public_folder: '/media/abiturienten'
fields: fields:
- {label: "Titel", name: "title", widget: "string"} - {label: "Titel", name: "title", widget: "string"}
- {label: "Entwurf", name: "draft", widget: "boolean", default: "false", required: false} - {label: "Entwurf", name: "draft", widget: "boolean", default: "false", required: false}

@ -10,8 +10,28 @@
<script src="https://unpkg.com/netlify-cms@^2.0.0/dist/netlify-cms.js"></script> <script src="https://unpkg.com/netlify-cms@^2.0.0/dist/netlify-cms.js"></script>
<script src="https://sharadcodes.github.io/hugo-shortcodes-netlify-cms/dist/hugo_shortcodes_netlify_cms.js"></script> <script src="https://sharadcodes.github.io/hugo-shortcodes-netlify-cms/dist/hugo_shortcodes_netlify_cms.js"></script>
<script> <script>
CMS.registerPreviewStyle("https://eesev9ie.github.io/style.css");
CMS.registerPreviewStyle("/style.css"); CMS.registerEditorComponent({
id: "gallery",
label: "Bildergallerie",
fields: {
name: "dir",
label: "Ordner",
widget: "string"
},
pattern: /{{< gallery dir="([a-zA-Z0-9]+)" >}}/,
fromBlock: function(match) {
return {
username: dir[1],
};
},
toBlock: function(obj) {
return `{{< gallery ${obj.dir} >}}`;
},
toPreview: function(obj) {
return `{{< gallery ${obj.dir} >}}`;
},
});
</script> </script>
</body> </body>
</html> </html>