getindiekit / indiekit

The little Node.js server with all the parts needed to publish content to your personal website and share it on social networks.
https://getindiekit.com
MIT License
341 stars 36 forks source link

Preset: Netlify CMS #371

Closed aciccarello closed 1 year ago

aciccarello commented 3 years ago

Is your feature request related to a problem? Please describe.

I currently have an 11ty backed site that is configured with Netlify CMS so that I can create/draft/edit posts and pages from an admin page.

I'm considering adding an indiekit based micropub endpoint but don't want to maintain two configurations which both describe how my site source is structured.

Describe the solution you’d like

I would like to use a preset (like the jekyll or hugo presets) to import my netlify CMS config and convert that into an indiekit config. This would start with pointing indiekit at the admin.yml file that defines the site config.

Some example mappings:

Site URL

Netilfy CMS config

site_url: https://your-site.com

Indiekit config

publication.me: https://your-site.com

Post kinds

Netilfy CMS config

media_folder: "static/images/uploads"
public_folder: "/images/uploads"
collections:
  - name: note
    label: Blog
    folder: content/blog
    extension: md
    slug: {{year}}-{{month}}-{{slug}}
    preview_path: blog/{{slug}}
  - label: Photos
    name: photo
    folder: '_posts/photos'
    extension: md
    slug: '{{year}}-{{month}}-{{day}}-{{slug}}'
    preview_path: photos/{{year}}/{{month}}/{{day}}/{{title}}

Indiekit post kinds

postTypes = [{
  type: 'note',
  name: 'Blog',
  post: {
    path: 'content/blog/{​yyyy}-{MM}-{​slug}.md',
    url: 'blog/{​slug}'
  },
}, {
  type: 'photo',
  name: 'Photograph',
  post: {
    path: '_posts/photos/{​yyyy}-{MM}-{dd}-{​slug}.md',
    url: 'photos/{yyyy}/{MM}/{dd}/{​slug}'
  },
  media: {
    path: 'static/images/uploads/{​filename}',
    url: 'images/uploads/{​filename}',
  }
}]

Slug separator

Netilfy CMS Config

slug:
  encoding: "ascii"
  clean_accents: true
  sanitize_replacement: "_"

Indiekit config

publication.slugSeparator: "_"

Describe alternatives you’ve considered

I've considered dropping my netlify CMS config when adding micropub, but I realized they offer different features. Netlify CMS is a broader tool for editing a website. Micropub would allow certain kinds of integrations with different UIs, primarily for posting new content.

Additional context

This is something I would consider helping with or possibly publishing myself. However I don't know when I'll have the bandwidth and I wanted to raise the idea in case others are interested.

aciccarello commented 1 year ago

I made an attempt at this but ran into several problems and no longer recommend it. It's simpler for me to maintain two configs than to try to map between.

Some challenges: