Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to avoid generating <div> tag when using <placeholder> #657

Closed
M4tZheng opened this issue Apr 21, 2021 · 4 comments
Closed

how to avoid generating <div> tag when using <placeholder> #657

M4tZheng opened this issue Apr 21, 2021 · 4 comments

Comments

@M4tZheng
Copy link

M4tZheng commented Apr 21, 2021

Using Sitecore JSS placeholder tag will generate a div, which is different from developing with Sitecore MVC. Is there a way to avoid generating these div tags?
I followed Sitecore documentation: JSS placeholder documentation

Here is the code used and html generated:

Promo Container

image
<Placeholder name='app-promos' :rendering="rendering"/>

Promo Card

enter image description here

Page Layout YAML

> placeholders:
      app-promos:
        - componentName: PromoCard
          fields:
            heading: PromoCard1
            image: 
              src: /data/media/img/promo-card-1.jpg
              alt: card1
            text: Card 1 desc...
            headline: Card 1
        - componentName: PromoCard
          fields:
            heading: PromoCard1
            image: 
              src: /data/media/img/promo-card-2.jpg
              alt: card2
            text: Card 2 desc...
            headline: Card 2
        - componentName: PromoCard
          fields:
            heading: PromoCard1
            image: 
              src: /data/media/img/promo-card-3.jpg
              alt: card3
            text: Card 3 desc...
            headline: Card 3

Generated HTML

image

Even the JSS sample code has the non-sense div generated.

@nickwesselman
Copy link
Contributor

@M4tZheng Can you let us know which JavaScript framework you are using?

@M4tZheng
Copy link
Author

M4tZheng commented Apr 23, 2021

@M4tZheng Can you let us know which JavaScript framework you are using?

@nickwesselman
vue js - release 13.0.0.
no issue there with react js 13.

@nickwesselman
Copy link
Contributor

@M4tZheng In React we are able to use Fragments to avoid a wrapping div. This capability was not added to Vue until Vue 3.x. We are planning to upgrade but do not have a committed release/date for this yet.

A workaround is to use the SitecoreJssPlaceholderPlugin as documented here.

@nickwesselman
Copy link
Contributor

Fragment support will be introduced with Vue 3.x in the JSS 19.0 release. See #742.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants