I am a new developer using IBM-WCM Websphere Portal 8.5.0. Some of the documentation on the IBM website is hard to understand. I am trying to allow the content author to use an image instead of a video. So if the still image is not empty use that if it is empty use the video.

I have tried using different plugins. Example- [Plugin:IfNotEmpty="[Element context='current' type='content' key='section_1_hero_image_still']"]. I have the key set to the title of the image they will upload on the authoring template.

   <div class="video-container show-for-medium">
     [Plugin:ifNotEmpty value="[Element context='current' type='content' key='section_1_hero_image_still']"]
     <img width="100%" src="[Element context='current' type='content' key='section_1_hero_image_still']" alt="[Element context='current' type='content' key='Hero Image']"/>
      [/Plugin:ifNotEmpty]  

      [Plugin:ifEmpty value="[Element context='current' type='content' key='section_1_hero_image_still']"]
      <video alt="Hero Image" aria-hidden="true" poster="" width="100%" muted="" loop="" autoplay="">
        <source src="[Element context="current" type="content" key="section_1_hero_video_mp4"]">
      </video>
      [/Plugin:ifEmpty]
    </div>

1 Answers

0
Venkatesh Varadharajan On

what you are doing is correct. There is no else logic and it has to be achieved using the [Plugin:ifNotEmpty] and [Plugin:ifEmpty] tags.