Pages that are marked Draft and not yet published still load and display via web components

Is this correct behavior, seems surprising

HI @gkappel , can you please share a live page from your site where the unpublished content is showing? Thanks!

https://zlsportal.zyus.ca/static/test.html

George Kappel
IT Systems Architect

ZYUS Life Sciences US Ltd.

Thanks George. I believe this is because the entry attribute is explicitly used on your webcomponent on that page. So that behavior is expected. Can you try removing entry from the webcomponent and changing the URL path in the Visual Editor to /static/test for that content?

using unique url works if published and does not display if unpublished as long as entry is not specified

HI @gkappel, just checking here, it sounds like this is the behavior you wanted, right? Is there anything else you need help with to set this up?

Yes thanks. We eliminated entry for pages and are using url. We also use sections, a section will be used on multiple pages and those page are not necessarily builder pages. So for sections is there an alternative approach besides using entry id?

Great. So for section models, yes one way is to include entry id. Alternatively, if you are on the Growth plan then you’ll have access to custom targeting attributes. This way you can set an attribute (e.g. sectionName = my-reuseable-section) on the entry you want to re-use. Then add a script alongside your web component that initializes the page’s sectionName attribute:

<script>
window.builderWcLoadCallbacks = [
  (context) =>
   context.builder.setUserAttributes({
      /* Add your targeting attributes for Builder
       * to dynamically load content to the web component above
       */
      sectionName: 'my-reuseable-section'
    })
];
</script>

Custom Targeting Attributes
Webcomponents API

thanks, that explanation helps

1 Like