Join the Webstudio community

Updated 11 months ago

Parent Variables of a Slot Within A Slot

At a glance

The post requests the ability to access variables that are parents of a slot within the slot itself, as the community member is working on a CMS and finding slots beneficial but unable to access certain variables. The comments discuss the technical feasibility of this, with one community member noting that content in slots cannot access variables outside as they may not exist, and suggesting a "nocode component" where variables are passed as props. Another community member wonders if they can accept the risk of the variable not being present, given their use case of different post types sharing common elements. The discussion concludes that global variables, in addition to instance variables, would need to be accessible across slot boundaries to enable this functionality.

Request: To allow variables that are parents of a slot to be accessible within a slot.

Is this technically feasible?

I'm messing with resources in prep for CMS and realizing how much my posts benefit from slots but I'll have to do without as of now
O
J
5 comments
content in slots can't have access to variables outside, because these may not exist depending on where slot is used cc @TrySound

can you describe the exact situation? maybe we have an idea how this can be solved differently
most likely you would want a nocode component where variables are passed as props from the place where the component is used
Can I accept the risk that the variable may not be present?

Use case: I have three different post types. They are all blog posts to an extent but different formats. They share the same header, byline, author box, ctas, but different body and URLs
If the "risk" was on the user (or handled gracefully), it would open up the ability for components (to an extent)
we had a long discussion with @TrySound it seems that we agree that we will need a global variables in addition to the instance variables and those global variables will be accessible across slot boundaries
Add a reply
Sign up and join the conversation on Discord