问题描述
我想显示博客文章列表,仅显示博客文章的标题和发布日期.但是,此刻它还显示博客文章的内容.
I want to show a list of blog posts, and just display the Title and publish date of the blog posts. However, at the moment, it also displays the content of the blog posts as well.
如何从显示在博客文章列表中的博客内容中删除?我不想依靠CSS,我想从标记中正确删除它.
How can I remove the blog content from being displayed on a blog post list? I don't want to rely on CSS, I'd like to remove it properly from the markup.
推荐答案
我设法弄清楚了.
在插件的深处,有一个名为default.htm
的文件.它位于这里:plugins/rainlab/blog/components/posts
.
Deep within the bowels of the plugin, there's a file called default.htm
. It's located here: plugins/rainlab/blog/components/posts
.
这是有问题的代码:
{% if post.excerpt %}
<p class="excerpt">{{ post.excerpt }}</p>
{% else %}
<div class="content">{{ post.content_html|raw }}</div>
{% endif %}
出于我的目的,我暂时删除了{% else %}
语句,但是我希望在此处做一些花哨的操作,以便在某些地方不显示内容的情况下显示博客文章列表,但随后在其他地方可见.
For my purposes, I've removed the {% else %}
statement for the time being, but I will hope to do something fancy here that will allow the blog post list to be displayed without the content in some places, but then be visible in other places.
这篇关于在OctoberCMS中显示博客文章列表时隐藏博客文章的内容?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!