机车CMS - 货车找不到content_type_template



不能使用事件content_type_template。重复官方教程(http://doc.locomotivecms.com/guides/content-types/create),并出现错误:找不到页面。请帮忙,我正在尝试解决此问题 3 小时!

/

app/content_types/events.yml

name: Events
slug: events
description: List of all events
label_field_name: title
order_by: manually # default: manually, also available: created_at or any field slug
# order_direction: asc # default: asc, also available: desc
# group_by: <your field>
# public_submission_enabled: false
# public_submission_accounts: ['john@acme.net']

fields: 
- title: # Name of the field
    label: Title
    type: string
    required: true
- description: # Name of the field
    label: Description
    type: text
    required: false
    # Enable or not the RTE [html|text]
    # text_formatting: html
- event_date: # Name of the field
    label: Event date
    type: date
    required: false
/

app/views/pages/events/content_type_template.liquid *是手动创建的!*

--
title: Event template page
content_type: events
published: true
---
{% extends parent %}
{% block main %}
    <h1>{{ event.title }} on {{ event.event_date || localized_date: '%m/%d/%Y' }}</h1>
    <p>{{ event.description }}</p>
{% endblock %}
/

app/views/pages/index.liquid

{% extends parent %}
{% block main %}
  <ul>
    {% for event in contents.events %}
      <li><a href="/events/{{ event._slug }}">{{ event.title }}</a></li>
    {% endfor %}
  </ul>
{% endblock %}

不确定您是否仍然遇到此问题。我遇到了同样的问题,并弄清楚了问题所在:

content_type_template有错别字。

<h1>{{ event.title }} on {{ event.event_date || localized_date: '%m/%d/%Y' }}</h1>

应该是

<h1>{{ event.title }} on {{ event.event_date || localized_date: '%m/%d/%Y' }}</h1>

数据文件夹中的文件 events.yml 包含不可能日期的示例数据。 就我而言 2013/39/02(格式 Y/M/D)

在这两个更正之后,该示例在此处工作。

相关内容

  • 没有找到相关文章

最新更新