Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Luke Hook 45 posts 175 karma points c-trib
    Sep 20, 2019 @ 13:02
    Luke Hook
    0

    New doc type field not published

    Hi guys,

    We have a project in Umbraco Cloud utilising baselines. Basic simple structure at the moment, nothing outside the ordinary.

    We've added a field to a doc type, a checkbox, by design this has a default value of true in order to show an element on a page.

    The site in question has, ~20 nodes that utilise this field. However it requires that EACH node is published (full, save and publish, republishing entire site does nothing).

    My issue is, I shouldn't have to manually re publish every single node in order for this to apply. Not to mention there may end up being 'n' number of sites inheriting the baseline.

    In short then, am I doing something wrong? is there a way to 'fully' republish everything? Would I need to build an endpoint that does this for each site in the baseline set up and link to the deploy webhook?

    Just looking for ideas on how anyone else is handling things like this. Thanks, Luke

  • Steve Megson 151 posts 1022 karma points MVP c-trib
    Sep 20, 2019 @ 13:59
    Steve Megson
    101

    This is a problem with adding a checkbox property to a doc type that's already in use. The default value that you configure on the data type only tells the editor to default the box to checked or unchecked when editing a new node. Any existing nodes have no value stored for the new property until you save and publish them, and templates will interpret that missing value as false.

    Although it won't always be an acceptable workaround, I tend to handle it by just naming the new property in a way that makes the default value false. If pages should be shown in the menu by default, name the property "Hide in menu" rather than "Show in menu".

  • Luke Hook 45 posts 175 karma points c-trib
    Sep 20, 2019 @ 14:11
    Luke Hook
    0

    Thanks Steve,

    I see, that's quite annoying but makes sense.

    We can probably invert our logic to work around this but as you sat that's not always acceptable.

    Thanks again for your prompt response,

    Luke

  • Steve Megson 151 posts 1022 karma points MVP c-trib
    Sep 20, 2019 @ 14:38
    Steve Megson
    0

    Another option could be adding a custom PropertyValueConverter which does respect the configured default value. Fixing the problem in the standard PropertyValueConverter could be a nasty breaking change for upgrades since people could be relying on the current behaviour, but that's not a problem in your own sites when you know what to expect.

Please Sign in or register to post replies

Write your reply to:

Draft