decap-cms icon indicating copy to clipboard operation
decap-cms copied to clipboard

feat(nested collections): allow additional content in flatter structure

Open adunkman opened this issue 3 years ago • 13 comments

Summary This commit fixes #4972 by allowing nested folders with additional content beyond an index file.

Side effect: To keep the feature simple, this will now show index files as pages within a folder in NetlifyCMS. This enables creating additional files alongside the given index, but is a change in behavior from the current implementation. There’s a quick table explaining over in https://github.com/netlify/netlify-cms/issues/4972#issuecomment-1164985786, but please let me know if there are any questions.

Motivation I’m working on a multilingual site which uses nested collections to manage regional content. The content is organized on disk by language, then region, then 4 files per region. Allowing additional content beyond an index file within nested collections (implementing #4972) allows NetlifyCMS to manage this content.

Test plan There are test changes in this PR, because nested collections were originally asserted to work differently — as demonstrated by https://github.com/netlify/netlify-cms/issues/4972#issuecomment-901834753, the current behavior is not very straightforward and as such the behavior change is intentional.

If you spot a hole in test coverage, I’d be happy to add tests!

Checklist

  • [x] I have read the contribution guidelines.
  • [x] Code is formatted via running yarn format.
  • [x] Tests are passing via running yarn test.
  • [ ] The status checks are successful (continuous integration). Those can be seen below. (pending PR)

Here is a photo of my cat, Toulouse! 😻

The light gently hits the face of a cat, looking upwards with his mouth open, from within an open clothes dryer. He’s showing his teeth, but softly like a warm towel. His light grey coat, white whiskers, and wizened eyes show he is a Russian Blue and Domestic Shorthair breed mix in middle to late age.

adunkman avatar Jun 24 '22 19:06 adunkman

I’m not quite sure what the failed check "Required PR Labels" is, but I’m not able to assign or edit PR labels. I’d appreciate an assist!

adunkman avatar Jun 24 '22 19:06 adunkman

Hmm, looking at the build failure, it seems to be unrelated to this changeset.

Error: error:0308010C:digital envelope routines::unsupported
    at new Hash (node:internal/crypto/hash:67:19)
    at Object.createHash (node:crypto:133:10)
    at module.exports (/home/runner/work/netlify-cms/netlify-cms/node_modules/webpack/lib/util/createHash.js:135:53)
    at NormalModule._initBuildHash (/home/runner/work/netlify-cms/netlify-cms/node_modules/webpack/lib/NormalModule.js:417:16)
    at handleParseError (/home/runner/work/netlify-cms/netlify-cms/node_modules/webpack/lib/NormalModule.js:471:10)
    at /home/runner/work/netlify-cms/netlify-cms/node_modules/webpack/lib/NormalModule.js:503:5
    at /home/runner/work/netlify-cms/netlify-cms/node_modules/webpack/lib/NormalModule.js:358:12
    at /home/runner/work/netlify-cms/netlify-cms/node_modules/loader-runner/lib/LoaderRunner.js:373:3
    at iterateNormalLoaders (/home/runner/work/netlify-cms/netlify-cms/node_modules/loader-runner/lib/LoaderRunner.js:214:10)
    at iterateNormalLoaders (/home/runner/work/netlify-cms/netlify-cms/node_modules/loader-runner/lib/LoaderRunner.js:221:10)
    at /home/runner/work/netlify-cms/netlify-cms/node_modules/loader-runner/lib/LoaderRunner.js:236:3
    at context.callback (/home/runner/work/netlify-cms/netlify-cms/node_modules/loader-runner/lib/LoaderRunner.js:111:13)
    at /home/runner/work/netlify-cms/netlify-cms/node_modules/babel-loader/lib/index.js:59:71 {
  opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
  library: 'digital envelope routines',
  reason: 'unsupported',
  code: 'ERR_OSSL_EVP_UNSUPPORTED'
}

adunkman avatar Jun 27 '22 15:06 adunkman

Is there any update on this PR? This seems useful

ashishkharche avatar Aug 08 '22 16:08 ashishkharche

@ashishkharche I believe the pull request is ready for a team member to review.

I suspect it is hard for the Netlify team to review pull requests at the moment due to the builds and tests being broken in CI. I reported that issue and got as far as I could get on fixing it in https://github.com/netlify/netlify-cms/pull/6509, but that pull request also has yet to be reviewed.

That’s the latest I know of on my end — apologies I can’t be of more help!

adunkman avatar Aug 09 '22 17:08 adunkman

@adunkman It's hard for @netlify/cms-maintainers to review because there is no one in that group. Nothing has been reviewed or merged since late May. Netlify support says the product team is deliberating whether to hire another maintainer or to stop maintaining altogether, and hope the community picks up the torch with a fork. Perhaps 18F would be interested?

bmackinney avatar Aug 09 '22 23:08 bmackinney

@bmackinney do you have a link to that conversation or was it a private message?

talves avatar Aug 09 '22 23:08 talves

Nevermind, I found it: https://answers.netlify.com/t/is-this-project-dead/70988

Thanks for asking the questions. There is so much here that needs to be addressed.

talves avatar Aug 09 '22 23:08 talves

@talves Yes there, I started by asking here. Some info was confirmed in a DM.

bmackinney avatar Aug 10 '22 00:08 bmackinney

Has any popular fork came out of this yet?

ashishkharche avatar Aug 10 '22 00:08 ashishkharche

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Apr 26 '23 09:04 stale[bot]

@adunkman (or anyone else involved) are you still interested in moving this forward?

martinjagodic avatar Oct 16 '23 12:10 martinjagodic

@adunkman (or anyone else involved) are you still interested in moving this forward?

Yes, can you merge these changes as they make the nested collections far more intuitive and usable. I have tested the changes on a custom local build of Decap CMS and they work as described by the author of the PR.

st0yanov avatar Jan 24 '24 11:01 st0yanov

+1 on better nesting.

I'm trying to have sub folders with files not named index.md in them and it doesn't look possible right now

DavidWells avatar Mar 22 '24 20:03 DavidWells