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.

Plugin Template for v3: Is There a New One?

default discord avatar
zed0547last year
7

Hey

@569873065152872479



Yes!

https://github.com/payloadcms/payload/tree/main/templates/plugin

pnpx create-payload-app -t plugin
  • default discord avatar
    ainsley.devlast year

    Oh look at that, thanks

    @654031862146007055

    !

  • default discord avatar
    zed0547last year

    My pleasure!

  • default discord avatar
    ainsley.devlast year
    @654031862146007055

    you probably know this mate.



    I want to create some fields in the plugin (will be a sitemap plugin) so users can specify:



    - Priortiy


    - If it should appear in the sitemap.


    For each page.



    But don’t want to just put it in all of their collections, was thinking about how I can open it up to users so they can do it themselves, I.e put it in the side bar etc.



    Does payload offer this flexibility already? Feel like seo plugin does. Don’t know if you have any source code that’s handy.

  • default discord avatar
    zed0547last year

    So, realistically, this would be most straightforward if you actually just appended a few fields to the target collections as specified in your plugin config



    A user enables this for collection with slug "pages", plugin appends some fields, everything is good



    If you are

    opposed

    to this, then my next thought would be something along the lines of what plugin-search does



    And that would be a hook to create a sitemap index doc in a distinct collection



    And then a hook for deletions

  • default discord avatar
    ainsley.devlast year

    Yeah I thought just appending a couple of fields would be best to start of with but don’t know if users would be annoyed with fields floating around.



    Second option is very intriguing. I’m trying to think what people would find better 🤔

  • default discord avatar
    zed0547last year

    Both will work, but option 2 is a little more work for you I think, you have the overhead of maintaining hooks that should manage create/update, and delete

  • default discord avatar
    ainsley.devlast year

    True true, I’ll go with keep it simple.



    Thanks 🙏 will share a link when it’s done.



    Going to make it very similar to Strapis one.

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.