When the page is “edit” I want the reusable to appear, currently I am using a this url “contains” edit argument to trigger the reusable element, but this doesn’t seem very robust (for example if the slug contains the word edit it would also trigger, which is unlikely but could happen)
Does anyone know a more robust way to do this? It seems like there should be a better way?
@adamhholmes Good question; because the new and edit pages contain large overlap in design, I am making use of a large number of reusable elements, and actually the reusable element I am trying to conditionally display is nested inside another reusable element which is common to both pages.
Ideally I’d like to use the URL; and I’ve wondered about this a few times on different projects, but always just found another way… rather than asking the community.
For example another method I can use is setting a state on the reusable element that is set differently on the edit page and the new page, and allows the reusable to “know” where it is.
I just feel programmatically, there might be something that can be done at the URL level (e.g. “when page is edit this element is visible”) and I’d like to explore this and hopefully add another tool to my belt!