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

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

adunkman
Copy link

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 #4972 (comment), 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 #4972 (comment), 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

  • I have read the contribution guidelines.
  • Code is formatted via running yarn format.
  • 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.

This commit fixes decaporg#4972 to allow 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.

Co-authored-by: Eric Gade <[email protected]>
@adunkman adunkman requested a review from a team June 24, 2022 19:30
@adunkman
Copy link
Author

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!

@krider2010 krider2010 added kind: feature type: feature code contributing to the implementation of a feature and/or user facing functionality area: locales labels Jun 27, 2022
@adunkman
Copy link
Author

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'
}

@ashishkharche
Copy link

Is there any update on this PR? This seems useful

@adunkman
Copy link
Author

adunkman commented Aug 9, 2022

@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 #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!

@bmackinney
Copy link
Contributor

@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?

@talves
Copy link
Collaborator

talves commented Aug 9, 2022

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

@talves
Copy link
Collaborator

talves commented Aug 9, 2022

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.

@bmackinney
Copy link
Contributor

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

@ashishkharche
Copy link

Has any popular fork came out of this yet?

@stale
Copy link

stale bot commented Apr 26, 2023

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.

@martinjagodic
Copy link
Member

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

Net-Slayer added a commit to Net-Slayer/static-cms that referenced this pull request Dec 8, 2023
@st0yanov
Copy link

@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.

@DavidWells
Copy link
Contributor

+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

goldinvo added a commit to goldinvo/goldinvo.github.io that referenced this pull request Aug 23, 2024
@fgnass
Copy link

fgnass commented Dec 21, 2024

It would be so great to get this PR merged! Is there anything I can do to help moving this forward? /cc @demshy

@martinjagodic
Copy link
Member

@fgnass NestedCollection.spec.js.snap has merge conflicts, could you solve them? Thanks!

You can also add your review of the PR; it will be helpful for sure!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: locales kind: feature pinned type: feature code contributing to the implementation of a feature and/or user facing functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make nested collections work with a flat content structure
9 participants