我正在尝试缩短帖子页面上帖子的长度,类似于你在wordpress codex片段中编程的方式,但这是python而我在这里使用jinja是我的代码
Posts.html
{% extends "layout.html" %}
{% block content %}
<div class="row">
<div class="container">
<h1 class="posts-title text-center">Our Blog</h1>
<div class="col-md-12 ">
<div class="posts">
{% for post in posts%}
<div id="article-post" class="post">
<div class="col-lg-12 col-xs-12 ">
<div class="container">
<h1 class="posts-title"> <a href ="{{ url_for('show', slug=post.slug) }}"> {{ post.title }} </a> </h1>
<p class="article-body">{{ post.body.length(200) }}</p>
<p>by: {{ post.author.username }}</p>
</div>
</div>
</div>
{% endfor %}
<div>
</div>
</div>
</div>
{% endblock %}
有什么建议吗?