Field's not being positioned in sidebar in a specific collection

default discord avatar
jakob5611
3 months ago
31

I have a collection Posts with a field slug. No matter what I do, the slug field will not go to the sidebar position.



If I copy and rename the same collection, the field will be in the sidebar. I tried dropping the posts collection from the database and re-creating it, but the outcome is the same.



Any ideas how I could solve this and not have to rename the collection to something else

  • discord user avatar
    jarrod_not_jared
    Payload Team
    3 months ago

    Are you sure there is only 1 slug field on that collection?



    What happens if you rename the

    name

    of your slug field?

  • default discord avatar
    jakob5611
    3 months ago

    Yes, there is one slug field. I renamed it, outcome is the same.



    I tried to add another field to the sidebar, it also didn't change the position.



    Is layout data persisted somewhere perhaps?

  • discord user avatar
    jarrod_not_jared
    Payload Team
    3 months ago

    rm your dist and build folders just be sure



    then stop/start dev server

  • default discord avatar
    jakob5611
    3 months ago

    Huh, that also didn't solve the issue. I also tried dropping the _preferences collection from db.



    Perhaps any other ideas?

  • discord user avatar
    jarrod_not_jared
    Payload Team
    3 months ago

    are you sure you are at the right url?



    something is definitely up, since you changed the field name and it did not appear



    do you have 2 collections with the same slug?

  • default discord avatar
    jakob5611
    3 months ago

    Yeah, I only have one "posts" collection. Double checked if i had a duplicate by mistake.



    If I copy/paste the same collection config to a new collection, fields will move to the sidebar in the new one.



    I don't think having a block named 'posts' could cause any collisions? This block is also not being used in any field inside posts collection



    If I rename the field, the name will change, position doesn't



    Short video of the issue

  • discord user avatar
    jarrod_not_jared
    Payload Team
    3 months ago

    That is very odd



    hmmmm

  • default discord avatar
    jakob5611
    3 months ago

    Should I open an issue about this? 🙂

  • discord user avatar
    jarrod_not_jared
    Payload Team
    3 months ago

    If you can pinpoint the issue



    it's hard for me to tell if it is real, but if you want to give the slug thought a try that would be awesome

  • default discord avatar
    jakob5611
    3 months ago

    I will retry with a clean installation and see If I can reproduce it 🙂

  • discord user avatar
    jarrod_not_jared
    Payload Team
    3 months ago

    Thanks! Let me know if you find anything!

  • default discord avatar
    jakob5611
    3 months ago

    Will do, thanks for the help 🙂



    @jarrod_not_jared Just a quick follow up - I have installed a fresh payload instance but with same src/ contents and collections config. The fields are also not showing in the sidebar.



    I will try to find if there is anything specific in my config that has an effect on this



    @jarrod_not_jared If I uninstall SEO plugin, the fields position themselves in the sidebar.

  • discord user avatar
    jarrod_not_jared
    Payload Team
    3 months ago

    you are on v1.0.13 of the seo plugin?

  • default discord avatar
    jakob5611
    3 months ago

    I am on version 1.0.14-canary.0



    But I also tried installing the plugin from github source



    @jarrod_not_jared I have found the exact circumstances where this happens.



    1. SEO plugin is in tabbed mode


    2. In the collection you don't have tabs or the fields you want in the sidebar are inside a tab



    Workaround:


    1. Have a single tab in your collection


    2. Fields you wish to have in the sidebar must not be inside the tab but after the tab field



    Like this:

    image.png
  • default discord avatar
    tinouti
    3 months ago

    Yup you got it right @jakob5611 !


    https://github.com/payloadcms/plugin-seo/issues/35#issuecomment-1548887650


    @jacobsfletch actually added something in the readme about this 👍 :



    If you wish to continue to use top-level or sidebar fields with tabbedUI, you must not let the default Content tab get created for you (see the note above). Instead, you must define the first field of your config with type tabs and place all other fields adjacent to this one.
  • default discord avatar
    jakob5611
    3 months ago

    @tinouti Ah, wish I had seen this sooner haha 🙂 Thanks for the reply, it does make sense.



    I would suggest maybe adding this to the docs for tab field? It took me some time to figure out it was the SEO plugin causing this



    Anyhow, I'm loving payload so far, especially the block field 🙂

  • default discord avatar
    tinouti
    3 months ago

    It really only is a quirk of how this plugin operates, so I don't think this has a place in the main payload docs.


    BUT now that you mention it, I do think we could point out in the

    Fields > Overview > Admin config > position

    docs that this only works when the field is defined at the "root" level of a collections' fields config.


    What do you think @jacobsfletch?



    (I'd make a PR for it, but I'm pretty sure the way I'm explaining it and the terms I'm using aren't the right ones 😅 )

Open the post
Continue the discussion in Discord
Like what we're doing?
Star us on GitHub!

Star

Connect with the Payload Community on Discord

Discord

online

Can't find what you're looking for?

Get help straight from the Payload team with an Enterprise License.