Templates 如何编写显示未缓存内容的NationBuilder部分模板?
我已经使用Liquid模板语言为NationBuilder编写了部分模板(据我所知,Liquid是唯一的选项)Templates 如何编写显示未缓存内容的NationBuilder部分模板?,templates,caching,liquid,Templates,Caching,Liquid,我已经使用Liquid模板语言为NationBuilder编写了部分模板(据我所知,Liquid是唯一的选项) {page.blog.most_recent_blog_posts limit:3 offset:0%} {{post.author.published_name_linked}·;{{post.published}日期:'%B%d,%Y%l:%M%p'} {%if post.show_流?%} {如果post.public_活动计数>0%} &米德多; {%endif%
{page.blog.most_recent_blog_posts limit:3 offset:0%}
{{post.author.published_name_linked}·;{{post.published}日期:'%B%d,%Y%l:%M%p'}
{%if post.show_流?%}
{如果post.public_活动计数>0%}
&米德多;
{%endif%}
{%endif%}
{%if post.blog_post.content.size>0%}
{{post.blog_post.content}
{%else%}
{%endif%}
{%if post.blog_post.content_flip.size>0%}
→
{%endif%}
{%endfor%}
此部分使用子页面标记包含在主页上。现在,当一篇新的博客文章被添加时,它不会出现在主页上,除非这个部分被再次保存,并且,我猜想,模板的缓存呈现被删除
有没有办法重写子页面标记或部分模板本身,以便在每次添加博客文章时强制重新呈现该模板?还是每次加载页面时?NationBuilder仪表板中是否有我缺少的设置?您的代码看起来不错。我在几个网站上工作过,它们使用partials进行动态更新 我唯一的建议是确保在测试浏览器更新时关闭浏览器中的缓存 或者,您可以使用
{%tag“tag\u name”和“partial”%}
语法来使用特定的标记获取文章。但是,这需要您标记这些帖子。
<h2 class="latest"><a href="/blog">News</a></h2>
{% for post in page.blog.most_recent_blog_posts limit:3 offset:0 %}
<div style="font-weight: bold; font-size: 16px;"><a href="{{ post.url }}">{{ post.headline }}</a></div>
<div class="byline">
{{ post.author.published_name_linked }} · {{ post.published_at | date: '%B %d, %Y %l:%M %p' }}
{% if post.show_stream? %}
{% if post.public_activities_count > 0 %}
· <a href="{{ post.url }}#reactions">{{ post.public_activities_count }} reaction{% if post.public_activities_count > 1 %}s{% endif %}</a>
{% endif %}
{% endif %}
</div>
{% if post.blog_post.content.size > 0 %}
{{ post.blog_post.content }}
{% else %}
<p />
{% endif %}
{% if post.blog_post.content_flip.size > 0 %}
<div class="continue_reading"><a href="{{ post.url }}">Read more</a> →</div>
{%endif %}
<hr/>
{% endfor %}