How do I add a hide function to the block list item - so it is hidden on the front-end but visible on the back end.
I want the icon to be visible with the copy and delete icons as seen the below
any direction or guidance is welcome
How do I add a hide function to the block list item - so it is hidden on the front-end but visible on the back end.
I want the icon to be visible with the copy and delete icons as seen the below
any direction or guidance is welcome
Hi!
I don’t know of any way Umbraco 13 provides this functionality.
How I would go about this is to create a composition containing a “hideInFrontend” true/false toggle. Then I would apply this composition on all of the items in the blocklist and add a check in the frontend whether to show/hide it.
With the extensibility of Umbraco 14+ I would reckon that it must be somehow possible on those versions
I do not want to go the composition route as that will mean it is going to be an attribute in the model settings bit, which makes it hidden as well. I hope it’s clear
Hi Anurella,
We’re doing this with the Nesting Contently package - it does require an umbracoNaviHide property on the blocks you want to hide, but it works just the way you want it, where the blocks are visible (and editable) in the Backoffice, but hidden from the frontend. You don’t even have to “handle” them in your partials - they’re just gone from the BlockList/BlockGrid model being rendered.
/Chriztian
I’m very curious why you want this? What’s the goal?
does this support v13
Yes it does - we’re using it in v10 and v13 (haven’t tried anything later).
/Chriztian
the aim is to allow editors build out pages - easily swap out an element without the need to delete while building, temporarily hide a block pending when you want it visible. All of it will making prototyping faster
I see the above, but I already use this alias to hide pages, would I still be able to use it for the block setup?
Yes you can (we’re doing the same thing). The property is local to the block so no conflicts…
@Anurella
You can handle this with a bit of custom logic. Just add a “Hide from Website” option in the block’s settings. Then, in your blocklist/default.cshtml
, check if this is selected—if yes, just skip rendering that block.