0

嗨,有谁知道如何更新下面的代码,以便博客“摘录”完全扩展为全文和图像/视频,无需点击?

谢谢,

大卫

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

1 回答 1

0

啊哈!它是用 Liquid (http://liquidmarkup.org/) 编写的。该truncatewords 方法获取文章的内容并将其缩短到最多 70 个单词。删除该方法调用应该可以解决问题。还有一种strip_html 方法似乎可以从文章内容中删除任何 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' %}
于 2011-11-05T16:39:16.453 回答