Available preview targets should dynamically update when the entry type (or other content) is changed #10488
-
DescriptionCraft Pro allows you to define multiple preview targets with custom URL formats. One feature that (as far as I know) is undocumented is that if a preview target template results in an empty string, it will not be shown in the frontend. We're using this to dynamically display different preview targets based on the entry type. For example, here is a preview target we have defined for a {% if object.type.handle != 'short_news' %}{{ object.url }}{% endif %} This preview target will only be displayed if the current entry type is not This is admittedly a very low-priority issue, but it would be nice if preview targets could be dynamically updated when the entry type changes. Of course, theoretically any attribute or field change could result in the preview targets changing, so maybe they need to be updated after every change? In any case, having preview targets differ based on entry type seems to be the most common scenario. Additional info
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
We only filter out empty targets to prevent Live Preview from showing up for entries that don’t actually have URLs. We did not mean for the feature to be exploited to create conditional preview targets. I’m not against us adding the feature, but considering this a feature request rather than a bug because it’s currently working as expected for the intended use case. |
Beta Was this translation helpful? Give feedback.
We only filter out empty targets to prevent Live Preview from showing up for entries that don’t actually have URLs. We did not mean for the feature to be exploited to create conditional preview targets. I’m not against us adding the feature, but considering this a feature request rather than a bug because it’s currently working as expected for the intended use case.