Can't use events content_type_template. Repeat official tutorial ( http://doc.locomotivecms.com/guides/content-types/create ), and have error: Page not found. Please help, i'm try resolve this problem 3 hours yet!
/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 * was created manually! *
--
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 %}
not sure if you still have this issue. I was running into the same problem and figured out what the problem was:
There is typo in the content_type_template.
<h1>{{ event.title }} on {{ event.event\\_date || localized_date: '%m/%d/%Y' }}</h1>
Should be
<h1>{{ event.title }} on {{ event.event_date || localized_date: '%m/%d/%Y' }}</h1>
The file events.yml in the data folder contains sample data with an impossible date. in my case 2013/39/02(format y/m/d)
After this two corrections, the example worked here.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.