更改代码以扩展Shopify Couture主题(Django?)上的博客条目

时间:2011-11-05 16:31:20

标签: blogs liquid shopify

您有没有人知道如何更新下面的代码,以便博客'摘录'完全展开全文和图片/视频,无需点击?

谢谢,

大卫

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' %}

1 个答案:

答案 0 :(得分:0)

啊哈!它是用Liquid编写的(http://liquidmarkup.org/)。 truncatewords method获取文章的内容并将其缩短为最多70个字。删除该方法调用应解决问题。还有strip_html method似乎从文章内容中删除了任何HTML。如果博客文章中有任何显示图像或视频的HTML,则可能需要将此方法归咎于删除它们。这可能会解决您的问题:

<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 }}
</div>
</div> <!-- /.article -->
{% endfor %}
</div> <!-- /.main -->
{% include 'sidebar' %}
</div> <!-- /.articles -->

{% include 'pagination' %}
{% endpaginate %}
</div> <!-- /#blog -->
{% include 'featured-products' %}