Everything between anchor tag render's raw html tags in Jekyll/Liquid

拥有回忆 提交于 2019-12-24 07:50:03

问题


I'm trying to build an include in Jekyll that has multiple variables, but the basic idea is that I'm wrapping multiple pieces of content in an anchor tag like the following:

<a href="#>
    <h2>{{ include.piece-title }}</h2>
    <h3>{{ include.piece-date }}</h3>
    <img src="{{ include.piece-url }}" alt="{{ include.image-description }}">
    <p>{{ include.piece-description }}</p>
</a>

However, this renders to the raw html (although the image works).

If I instead wrap it in a <figure> tag instead of the <a> tag, it doesn't have a problem. For example, this is fine:

<figure>
    <h2>{{ include.piece-title }}</h2>
    <h3>{{ include.piece-date }}</h3>
    <img src="{{ include.piece-url }}" alt="{{ include.image-description }}">
    <p>{{ include.piece-description }}</p>
</figure>

I can actually solve this by wrapping the <a> tags in other html like <figure> or <div> like the following, but this seems a bit overkill:

<figure>
    <a href="#">
        <h2>{{ include.piece-title }}</h2>
        <h3>{{ include.piece-date }}</h3>
        <img src="{{ include.piece-url }}" alt="{{ include.image-description }}">
        <p>{{ include.piece-description }}</p>
    </a>
</figure>

I've been searching high and low, but I can't find anything that references behavior like this except the order of operations. I can't seem to see where this would break the order though.

来源:https://stackoverflow.com/questions/57218699/everything-between-anchor-tag-renders-raw-html-tags-in-jekyll-liquid

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!