html - Jekyll 中输出多个段落标签

标签 html jekyll liquid

我不知道为什么,但由于某种原因,我的页面上输出了多个空段落标签。我的模板如下所示:

<article class="post-item sm-col sm-col-12 md-col md-col-5 {{ thecycle }}">
  <header>
    <h3><a href="{{ post.url }}">{{ post.title }}</a></h3>
  </header>
  <p>{{ post.excerpt }}<p>
  <footer>
    <p class="date"><time pubdate datetime="{{ post.date }}">{{ post.date | date: "%B %-d, %Y" }}</time></p>
  </footer>
</article>

但是我的静态 HTML 看起来像这样:

enter image description here

那些额外的段落标签从哪里来?

如有任何帮助,我们将不胜感激。提前致谢!

最佳答案

这是因为post.excerpt已经包含在 p 标签中。

如果你想输出没有p标签的摘录,你可以这样做 {{ post.excerpt | remove: '<p>' | remove: '</p>' }} .

See Jekyll documentation .

关于html - Jekyll 中输出多个段落标签,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28948031/

相关文章:

html - 如何将内容对齐到顶部

html - Jekyll & KramDown - 如何显示表格边框

json - 如何在 Jekyll 上使用 pygment JSON 代码?

javascript - 尝试在 Shopify 上使用特定产品标签显示相关产品

Shopify - 将尺寸变体从选择下拉菜单更改为按钮

javascript - 多选 Jquery 插件问题

html - 覆盖响应式网站的 ASP.NET DropDownList 宽度

html - CSS 彼此相邻对齐,烦人的边框应该只适用于一个 div

php - 具有动态组件的静态站点生成器

javascript - 将液体分配给 JavaScript 变量