decaporg / decap-cms

A Git-based CMS for Static Site Generators
https://decapcms.org
MIT License
17.94k stars 3.04k forks source link

Support Hugo Page Bundles #1697

Closed yani- closed 6 years ago

yani- commented 6 years ago

Is your feature request related to a problem? Please describe. My content is organized in page bundles:

/content/posts/my-cool-article/index.md
/content/posts/my-other-cool-article/index.md

I would like that NetlifyCMS can handle content organized this way.

Describe the solution you'd like In config.yml, I should be able to do something like this:

collections:
  - name: "posts"
    label: "Posts"
    folder: "content/posts"
    slug: "{{slug}}/index.md"

Describe alternatives you've considered

Additional context

yani- commented 6 years ago

Duplicate of https://github.com/netlify/netlify-cms/issues/513

gregmac commented 5 years ago

Also related: bundling image assets is #1472

zabatonni commented 4 years ago

This is not solved for me.

Hugo page bundle (branch) has structure like this: /parent/_index.md /parent/sub1.md /parent/sub2/_index.md /parent/sub2/inside.md

Each file produces url based on folder and filename. But most important is, that these pages have hierarchy usable in code. So I can output list of all child pages that belong to parent page.

I tried using beta feature slug and path with combination of url frontmatter, but it doesn't work.

barthc commented 4 years ago

@zabatonni can you show your config file.

zabatonni commented 4 years ago

I have no working config file to show:

collections:
- name: pages_en
  label: Pages EN
  folder: content/en
  create: true
  path: '{{PARENT_DIR???}}/{{PARENT_DIR2???}}/{{slug}}'
zabatonni commented 4 years ago

@barthc please take a look at https://gohugo.io/content-management/page-bundles/

there are 2 types of bundles and netlifycms only supports {{slug}}/index.md or {{slug}}/_index.md

I think only solution is to show folders and be able to manage (create/rename/delete) files and folders. Forestry.io does this using regex pattern when defining sidebar "collections" like this: **/*

barthc commented 4 years ago

path: '{{PARENT_DIR???}}/{{PARENT_DIR2???}}/{{slug}}'

and netlifycms only supports {{slug}}/index.md or {{slug}}/_index.md

At the moment the path config only supports placehoder as stated in the doc here

You can now specify an additional path template (similar to the slug template) to control the content destination.

You can also hardcode the directory name in the path config.

path: 'folder1/folder2/{{slug}}'
zabatonni commented 4 years ago

@barthc But there are hundreds of folders made dynamically by client (it was WP before, after migrating to Hugo all parent and child connections are done using folders), no way one could maintain it in config.

barthc commented 4 years ago

Another workaround is to pull the folder name from the entry. Maybe a dropdown, and then do something like

path: '{{fields.folder1}}/{{fields.folder2}}/{{slug}}'

@erezrokah does the path config support the fields. placeholder?

zabatonni commented 4 years ago

ok, and if i want to move pages, or rename folders? Folder would be created only on post creation, but if there is a typo and post title is changed, how this change will reflect folder structure?

erezrokah commented 4 years ago

Hi @zabatonni, that workflow should be covered in https://github.com/netlify/netlify-cms/issues/3227

edwinthomasg commented 1 year ago

I have no working config file to show:

collections:
- name: pages_en
  label: Pages EN
  folder: content/en
  create: true
  path: '{{PARENT_DIR???}}/{{PARENT_DIR2???}}/{{slug}}'

I too have same issue, Have you found out any solution using path and slug?