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

Wrapping an anchor tag around a bookshop tag causes malformed html #59

Closed
Yoda-Soda opened this issue Oct 18, 2021 · 1 comment
Closed

Comments

@Yoda-Soda
Copy link
Contributor

Yoda-Soda commented Oct 18, 2021

In the case of wrapping an anchor tag over a bookshop tag the anchor tag gets duplicated on each bookshop generated comment tag. For example:

  {% for card in include.icon_cards %}
      <a href="card.link_url">
          {% bookshop cards/icon-card bind=card %}
      </a>
  {% endfor %}

generates:

<a href="card.link_url">
  <!--bookshop-live name(cards/icon-card/icon-card.jekyll.html) params(bind=card) context(card=icon_cards[0]) -->
</a>
<div class="c-cards-icon-card">
  <a href="card.link_url">
    <div>
        <img />
    </div>
    <header>Title</header>
    <p>Content</p>
    <!--bookshop-live name(generic/link/link.jekyll.html) params(bind=include.link) context() -->
  </a>
<a  href="" >
    Read more
</a>
<!--bookshop-live end-->
</div>
@bglw
Copy link
Contributor

bglw commented Oct 18, 2021

This isn't a bug with Bookshop, and is actually an issue with the nested anchor tags in your example. See Why are nested anchor tags illegal

You could reproduce this same behaviour by dropping the following snippet into a template:

<a href="one">
  <h1>Hello <a href="two">World</a></h1>
</a>

@bglw bglw closed this as completed Oct 18, 2021
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