Simplify your stack and build anything. Or everything.
Build tomorrow’s web with a modern solution you truly own.
Code-based nature means you can build on top of it to power anything.
It’s time to take back your content infrastructure.

Generate breadcrumb array between different collections

default discord avatar
mumincelal2 years ago
4

Hello,



I am using nested-docs plugin to create breadcrumbs. 4 different collection use nested-docs but when I select parent page from one collection to another, the plugin doesn't create breadcrumbs correctly. It doesn't care parent page but I select parent page in same collection then the plugin is successful to create breadcrumbs correctly.



What is the problem here?



Here is my setup:



nestedDocs({ collections: [Page.slug, Post.slug, EnBlog.slug, TrBlog.slug], parentFieldSlug: 'parent', breadcrumbsFieldSlug: 'breadcrumbs', generateLabel: (_, page) => (page.name as string) || '', generateURL: (pages) => pages.reduce((url, page) =>

${url}/${page.slug}

, '') })

If I choose a parent from page collection to page collection, plugin works correct but If I choose a parent from post collection to page collection then plugin can not generate parent page breadcrumbs.

  • default discord avatar
    notchr2 years ago

    Hmm good question Mumin, I think

    @808734492645785600

    can help with this one as they most recently updated that repo

  • default discord avatar
    mumincelal2 years ago
    @808734492645785600

    any idea?

  • discord user avatar
    jacobsfletch
    2 years ago

    Interesting, the plugin was never designed to work across multiple collections like that. I'm not sure we'd ever be able to create hierarchy in this way without some rethinking how we traverse documents up the tree.

  • default discord avatar
    mumincelal2 years ago

    I don't know you have plan to integrate this but I created an issue for that anyway.

    https://github.com/payloadcms/plugin-nested-docs/issues/19
Star on GitHub

Star

Chat on Discord

Discord

online

Can't find what you're looking for?

Get dedicated engineering support directly from the Payload team.