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

Pages outside of 'path' are also listed in collections #4884

Open
LorenzBischof opened this issue Jan 27, 2021 · 4 comments
Open

Pages outside of 'path' are also listed in collections #4884

LorenzBischof opened this issue Jan 27, 2021 · 4 comments
Labels
type: bug code to address defects in shipped code

Comments

@LorenzBischof
Copy link

LorenzBischof commented Jan 27, 2021

Describe the bug

A folder collection with path specified as {{slug}}/index also lists pages in folder that are not in a subdirectory.

To Reproduce

  1. Clone repository: https://github.com/lbischof/issue-4884
  2. Start a webserver and local proxy server (see README.md)
  3. Visit localhost:8080/admin/
  4. See that "This should not appear" is also listed.

Expected behavior
I expect that if path is specified with a /, then all posts/pages that do not fulfill this requirement should be ignored and not listed.

Applicable Versions:

  • Netlify CMS version: 2.10.84

CMS configuration
https://github.com/lbischof/issue-4884

@LorenzBischof LorenzBischof added the type: bug code to address defects in shipped code label Jan 27, 2021
@smashercosmo
Copy link
Contributor

I can confirm. Seems like a bug. I'll look into it.

@smashercosmo
Copy link
Contributor

smashercosmo commented Feb 22, 2021

@erezrokah I'm trying to replicate it in dev-test demo. This doesn't work. Any idea what am I doing wrong? :)

  window.repoFiles = {
   _test: {
      post1: {
        'index.md': {
          content: '---\ntitle: "post1"\n---\n',
        }
      },
      post2: {
        'index.md': {
          content: '---\ntitle: "post2"\n---\n',
        }
      },
      post3: {
        'index.md': {
          content: '---\ntitle: "post3"\n---\n',
        }
      }
    }
  }
collections:
  - name: 'test'
    label: 'Test'
    folder: '_test'
    path: '{{slug}}/index'
    fields:
      - { label: 'Title', name: 'title', widget: 'string' }

@erezrokah
Copy link
Contributor

I'm not sure @smashercosmo as each backend handles nested collections a bit different.
Maybe try using npx netlify-cms-proxy-server?

@smashercosmo
Copy link
Contributor

Ok, I have to admit this is more complicated than I expected. I understand where this issue comes from (currently we only care about 'depth' and not take into account the actual custom collection path), but in order to fix it properly, I need to have very good understanding of how custom collection paths and nested collections and i18n works together. The issue is not critical so I would wait for when we get rid of immutable everywhere and convert everything to typescript so that code will be easier to follow and debug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug code to address defects in shipped code
Projects
None yet
Development

No branches or pull requests

3 participants