Skip to content

Instantly share code, notes, and snippets.

@officialrajdeepsingh
Created November 15, 2022 08:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save officialrajdeepsingh/7f6ea6a97b4b3f57e77c4daae598a66e to your computer and use it in GitHub Desktop.
Save officialrajdeepsingh/7f6ea6a97b4b3f57e77c4daae598a66e to your computer and use it in GitHub Desktop.
netlify_cms config in javavscript
import f from "https://deno.land/x/netlify_cms_config@v0.2.0/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