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.

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

default discord avatar
jakob5611last year
17

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

  • 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
    jakob5611last year

    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?

  • rm your dist and build folders just be sure



    then stop/start dev server

  • default discord avatar
    jakob5611last year

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



    Perhaps any other ideas?

  • 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
    jakob5611last year

    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

  • That is very odd



    hmmmm

  • default discord avatar
    jakob5611last year

    Should I open an issue about this? ๐Ÿ™‚

  • 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
    jakob5611last year

    I will retry with a clean installation and see If I can reproduce it ๐Ÿ™‚

  • Thanks! Let me know if you find anything!

  • default discord avatar
    jakob5611last year

    Will do, thanks for the help ๐Ÿ™‚



    @281120856527077378

    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



    @281120856527077378

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

  • you are on v1.0.13 of the seo plugin?

  • default discord avatar
    jakob5611last year

    I am on version 1.0.14-canary.0



    But I also tried installing the plugin from github source



    @281120856527077378

    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:

  • default discord avatar
    tinoutilast year

    Yup you got it right

    @881462909199331358

    !


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

    @808734492645785600

    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
    jakob5611last year
    @233209174069084161

    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
    tinoutilast year

    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

    @808734492645785600

    ?



    (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 ๐Ÿ˜… )

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.