Skip to content

Instantly share code, notes, and snippets.

@MWDelaney
Last active May 27, 2022 14:36
Show Gist options
  • Save MWDelaney/768479314e42ae73ea26a7e267506006 to your computer and use it in GitHub Desktop.
Save MWDelaney/768479314e42ae73ea26a7e267506006 to your computer and use it in GitHub Desktop.
Create separate, stripped-down NetlifyCMS editors for stores in an Eleventy collection
---
eleventyExcludeFromCollections: true
pagination:
data: collections.stores
size: 1
alias: store
eleventyComputed:
title: "{{ store.data.title }} Content Manager config"
permalink: "/stores/{{ store.data.slugOverride | slugify }}/admin/config.yml"
---
backend:
name: git-gateway
branch: master
media_folder: "src/assets/images"
public_folder: "/assets/images"
collections:
- name: "stores"
label: "Stores"
folder: "src/content/stores"
create: false
extension: "njk"
format: "frontmatter"
summary: {{ store.data.title }}
filter: {field: "title", value: "{{ store.data.title }}"}
editor:
preview: false
fields:
- { label: "Title", name: "title", widget: "hidden" }
- { label: "New Arrivals", name: "newArrivals", widget: "markdown" }
- { label: "Last Updated", name: "date", widget: "date" }
- { label: "Address", name: "address", widget: "hidden" }
- { label: "Phone Number", name: "phone", widget: "hidden" }
- label: "Featured Products"
name: "featuredProducts"
widget: "list"
required: false
fields:
- { label: "Title", name: "title", widget: "string" }
- { label: "Content", name: "intro", widget: "markdown" }
- { label: "Image", name: "image", widget: "image" }
- { label: "Image Alternative Text", name: "altText", widget: "string" }
---
eleventyExcludeFromCollections: true
pagination:
data: collections.stores
size: 1
alias: store
eleventyComputed:
title: "{{ store.data.title }} Content Manager"
permalink: "/stores/{{ store.data.slugOverride | slugify }}/admin/"
---
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="robots" content="noindex, nofollow">
<title>{{ store.data.title }} Store Content Manager</title>
<script src="https://identity.netlify.com/v1/netlify-identity-widget.js"></script>
</head>
<body>
<!-- Include the script that builds the page and powers Netlify CMS -->
<script src="https://unpkg.com/netlify-cms@^2.0.0/dist/netlify-cms.js"></script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment