更改代码以扩展 Shopify Couture 主题(Django?)上的博客条目
您好,有谁知道如何更新下面的代码,以便博客“摘录”完全扩展为全文和图像/视频,而无需点击?
谢谢,
大卫
div id="blog" class="clearfix">
{% paginate blog.articles by settings.pagination_limit %}
<div class="more-info clearfix">
<span class="upper">{{ blog.title }}</span>
<span class="lower">{{ blog.articles_count }} {{ blog.articles_count | pluralize: 'Article', 'Articles' }}</span>
</div>
{% for article in blog.articles %}
<div class="article clearfix">
<div class="content">
<h4><a href="{{ article.url }}">{{ article.title }}</a></h4>
{{ article.content | strip_html | truncatewords:70 }}
</div>
</div> <!-- /.article -->
{% endfor %}
</div> <!-- /.main -->
{% include 'sidebar' %}
</div> <!-- /.articles -->
{% include 'pagination' %}
{% endpaginate %}
</div> <!-- /#blog -->
{% include 'featured-products' %}
Hi does anyone know how to update the code below so that blog 'excerpts' are fully expanded with full text and image/video removing the need to click through?
Thanks,
David
div id="blog" class="clearfix">
{% paginate blog.articles by settings.pagination_limit %}
<div class="more-info clearfix">
<span class="upper">{{ blog.title }}</span>
<span class="lower">{{ blog.articles_count }} {{ blog.articles_count | pluralize: 'Article', 'Articles' }}</span>
</div>
{% for article in blog.articles %}
<div class="article clearfix">
<div class="content">
<h4><a href="{{ article.url }}">{{ article.title }}</a></h4>
{{ article.content | strip_html | truncatewords:70 }}
</div>
</div> <!-- /.article -->
{% endfor %}
</div> <!-- /.main -->
{% include 'sidebar' %}
</div> <!-- /.articles -->
{% include 'pagination' %}
{% endpaginate %}
</div> <!-- /#blog -->
{% include 'featured-products' %}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
啊哈!它是用 Liquid (http://liquidmarkup.org/) 编写的。
truncatewords
方法采用文章的内容并将其缩短至最多 70 个字。删除该方法调用应该可以解决问题。还有一个strip_html
方法似乎从文章内容中删除了任何 HTML。如果博客文章中有任何显示图像或视频的 HTML,则此方法可能是删除它们的罪魁祸首。这可能会解决您的问题:Aha! It’s written with Liquid (http://liquidmarkup.org/). The
truncatewords
method takes the article’s content and shortens it to a maximum of 70 words. Removing that method call should fix the problem. There’s also astrip_html
method that seems to remove any HTML from an article’s content. If there’s any HTML in the blog post that displays images or videos, this method may be to blame for removing them. This may fix your problem: