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.

Hard to understand website template code

default discord avatar
rnbsovlast year
12

I'm having troubles with understanding website template code, especially the posts collection



there is some hooks , that I don't understand what they do, and i don't understand why populateAuthors field is needed

  • default discord avatar
    tan5085last year

    my honest suggestion would be throw all the code into A.I and ask it to explain it to you, because it's actually really well built, almost self documented code. I found it easy to modify and enhance.



    BUT that could be because I'm just more experienced.

  • default discord avatar
    rnbsovlast year

    yep, I'm beginner with not a lot of experience



    I'm sorry, can you please help me



    I don't get why this position in the default example doesn't work



  • default discord avatar
    zed0547last year

    Yeah, the sidebar position prop is meant for top-level fields, fields in a tab will not work here because the check for it is simple



    If you move the categories to the top level of the collection, it'll work

  • default discord avatar
    rnbsovlast year

    check for it is simple?



    didn't get this

  • default discord avatar
    zed0547last year

    The code that assigns fields to the sidebar doesn't move down the tree of fields, it only looks at top level fields

  • default discord avatar
    rnbsovlast year

    strange then, probably should be type warning or something, not sure it possible to implement



    but this presence in the template confusing me



    oh I see, thanks

  • default discord avatar
    zed0547last year
    not sure it possible to implement

    Instead of nesting your categories field there, move it to the top level



    Then it'll show up in your sidebar

  • default discord avatar
    rnbsovlast year

    no, I meant there should be type warning from payload



    that it won't be visible



    and there is no point to specify it then



    if it not top level field



    @654031862146007055

    sir can you please help me



    does my words make any sense?

  • default discord avatar
    zed0547last year

    Not really



    I'm not following here

  • default discord avatar
    rnbsovlast year

    wdym



    anyways



    I have some problems with creating some model



    could you please help me



    I guess it won't take lot of time from you]



    but as I begineer I'm struggling with some collection I need to create

  • default discord avatar
    zed0547last year
    there is no point to specify it then

    If you want the field to show up in the sidebar it can't be nested within other fields, I'm not sure about type warning because that depends on if TS can actually evaluate how nested it is



    could you please help me

    For sure, go ahead and open a new thread here in community-help and tag me

  • default discord avatar
    rnbsovlast year

    yeah, from TS side it seems to be hard to implement



    thanks a lot! I will tag you once, I will explain my problem there

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.