Can we only allow one instance of a block to be selected?

default discord avatar
MRLlast year

I have for example a footer block which if specified on a page, it will show the footer on the website.

Is there a way to stop the CMS user from adding multiple footer blocks to the page?

I know I can set min and max rows to 1, however there are also other blocks that they could add other than the footer, so we can't use these fields.

  • default discord avatar
    Mark | Omniuxlast year

    Have you thought about using Footers as a Global Type instead? Then in the page collection you could create a toggle that opts in to show or hide the footer

  • default discord avatar
    MRLlast year

    I haven’t, no. But will look into it.

  • default discord avatar
    Jarrodlast year

    Yep, a global is the way to go here. Fetch the global data on the front end and render the footer with it. If you only want it on certain pages you could add a checkbox to your pages and check to see if the page should render the footer - this will take some extra legwork on your frontend side to do but totally possible.

Star on GitHub


Chat on Discord



Can't find what you're looking for?

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