Created
November 15, 2022 08:02
-
-
Save officialrajdeepsingh/7f6ea6a97b4b3f57e77c4daae598a66e to your computer and use it in GitHub Desktop.
netlify_cms config in javavscript
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import f from "https://deno.land/x/[email protected]/mod.ts"; | |
f.defaultRequired = false; | |
const config = { | |
backend: { | |
name: "git-gateway", | |
branch: "master", | |
}, | |
media_folder: "images", | |
collections: [], | |
}; | |
// Posts | |
config.collections.push( | |
f.folder("Posts", "posts") | |
.description("Here you can create or edit your posts") | |
.preview(false) | |
.create(true) | |
.viewFilter("Draft", "draft", true) | |
.fields([ | |
f.string("Title"), | |
f.string("Description"), | |
f.datetime("Date"), | |
f.list("Tags"), | |
f.boolean("Draft").required(false), | |
f.markdown("Body"), | |
]) | |
.toJSON(), | |
); | |
const pageFields = [ | |
f.string("Title"), | |
f.string("Url"), | |
f.markdown("Body"), | |
f.object("Menu", [ | |
f.boolean("Visible"), | |
f.number("Order"), | |
]), | |
f.hidden("templateClass"), | |
f.hidden("layout"), | |
]; | |
// Individual pages | |
config.collections.push( | |
f.files("Pages") | |
.description("Here you can edit your individual pages") | |
.preview(false) | |
.file("About", "about.md", pageFields) | |
.file("404", "404.md", pageFields) | |
.toJSON(), | |
); | |
export default config; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment