Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NetlifyCMS Support #248

Open
alex-shpak opened this issue Jul 17, 2020 · 1 comment
Open

NetlifyCMS Support #248

alex-shpak opened this issue Jul 17, 2020 · 1 comment
Labels
enhancement New feature or request

Comments

@alex-shpak
Copy link
Owner

A note for future:

Recently NetlifyCMS added support for nested collections: decaporg/decap-cms#3716
That means netlifycms admin panel can be used to manage this theme content, it will require some shuffle in content structure because name.md files are not supported, only folder structure with _index.md files is.

Example config:

backend:
  # ...

media_folder: "static/images/uploads"
public_folder: "/images/uploads"

collections:
  - name: "document"
    label: "Documents"
    label_singular: "Document"
    folder: "content/docs"
    create: true
    nested: { depth: 10 }
    fields:
      - { label: "Layout", name: "layout", widget: "hidden", default: "docs" }
      - { label: "Title", name: "title", widget: "string" }
      - { label: "Body", name: "body", widget: "markdown" }
    meta: { path: { widget: string, label: 'Path', index_file: '_index' } }

  - name: "post"
    label: "Posts"
    label_singular: "Post"
    folder: "content/posts"
    create: true
    fields:
      - { label: "Layout", name: "layout", widget: "hidden", default: "posts" }
      - { label: "Title", name: "title", widget: "string" }
      - { label: "Body", name: "body", widget: "markdown" }
@alex-shpak alex-shpak added the enhancement New feature or request label Jul 17, 2020
@alex-shpak alex-shpak changed the title Netlify CMS Support NetlifyCMS Support Jul 17, 2020
@michaeltlombardi
Copy link
Contributor

michaeltlombardi commented Feb 17, 2022

I've been working through a similar space (for a project built on top of hugo-book) but I think the requirement to use only _index.md files is a bit of a show-stopper for broader adoption right now - that's less intuitive imo than additional pages in the default hierarchy as currently implemented.

I did find this very useful hugo module (tnd-netlifycms) which makes adding NetlifyCMS to your hugo site much easier. I think it should be possible to at least support the posts collection by default if that module is included by filling out the data/netlifycms folder with required data files (fields and collections with a default config.yaml). I have actually done just this in hugo-platen-netlify to enable my users to write posts from Netlify, though I haven't hooked up all of the shortcodes properly yet.

I would be happy to help with this and contribute my work upstream to hugo-book if that would be helpful.

Edit: the unblocking issue for easier adoption of NetlifyCMS for book section collections (i.e. without having to entirely restructure how you organize your files/folders) is filed and under consideration but not implemented.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants