You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Lektor站点flowblock在Admin视图正常显示但内容页不显示问题咨询

故障原因及修复方案


1. 模板调用字段与模型配置不匹配

你在speisekarte.ini中定义的flow字段名称为salat,但在speisekarte.html模板中循环调用的是this.demo_flow.blocks,字段名完全不对应,导致无法读取到配置的flow块内容。
修复方法:将模板中的循环代码替换为以下内容:

{% for blk in this.salat.blocks %}
<div class="block block-{{ blk._flowblock }}">
    {{ blk }}
</div>
{% endfor %}

2. flow块模板配置错误

存在两个问题:

  • Lektor要求flow块的模板必须存放在项目的templates/blocks/目录下,如果你把gericht.html放在templates根目录,系统无法识别调用
  • 现有gericht.html仅渲染了text字段,你在块配置中定义的preis、inhalt字段均未加入模板,就算渲染成功也会缺失内容
    修复方法:
  1. 新建templates/blocks/目录(已存在则跳过),将gericht.html移动到该目录下
  2. 修改gericht.html内容,补全需要展示的字段,示例如下:
<div class="text-block text-block-{{ this.class }}">
  <h3>{{ this.text }}</h3>
  <p class="inhalt">{{ this.inhalt }}</p>
  <span class="preis">{{ this.preis }}</span>
</div>

3. 模型配置拼写错误

speisekarte.ini中[fields.salat]下的键名拼写错误,lable应为label,该错误虽不影响前端渲染,但会导致后台字段名显示异常。
修复方法:将lable = Salat修改为label = Salat


内容的提问来源于stack exchange,提问作者Jasmin Nagel

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.10.04 07:45:02