The syntax is wrong, there is no
pages: true and the indentation seems to be incorrect as well.
- width: 1/2
- width: 1/2
- width: 1/2
events: sections/events # have you defined the section in `site/blueprints/sections/events.yml`?
## but why this below if you already add the section in the line above?
?? I don’t quite get what you mean.
How to enable Template selection field as shown in contents of dotted red rectangle.
I have this for “site/blueprints/sections/events.yml”
sortBy: from asc
empty: No events yet
sortBy: date desc
I pulled this example from here:
create: default option you define that new pages are only created with the default blueprint. Set this to
to only create pages with the
event blueprint, or set a list of options. Please see the documentation for section options: https://getkirby.com/docs/reference/panel/sections/pages
Your suggestion is not working for me.
Are you suggesting this:
Please do not post code as screenshots but always as code blocks.
First of all, you use two sections with the same name (pages), which is not possible.
Secondly, what is in
sections/events? Does this file exist? If not, I assume you want to display your events in a section similar to the notes, right?
headline: My events
The way I have the “site.yml” as defined above in screenshot you told me to paste as code block (which won’t paste for me for some reason) results in this, in the dashboard:
That looks good to me? Now you have an events section with subpages. What happens now if you click on
Add in the events section?
I’d remove the
events page from the pages section underneath, though (in the block with About us, Home, Events)
If you mean here:
Then I am able to create Sub pages i.e. “Let’s go out for ice cream”.
“event.php” looks like this:
<?php snippet('header') ?>
<?= $page->title() ?>
<?= $page->date()->toDate('d F Y') ?>
<?php if ($page->tags()->iseventmpty()) : ?>
<?= $page->tags() ?>
<?php endif ?>
<div class="event-text text">
<?= $page->text()->kt() ?>
<?php foreach ($page->children()->listed()->sortBy('date', 'desc') as $event): ?>
<a href="<?= $event->url() ?>">
<h2><?= $event->title() ?></h2>
<time><?= $event->start()->toDate('d F Y') ?></time>
<?php endforeach ?>
<?php snippet('footer') ?>
However the date issue hasn’t been resolved on the front end.
I am unable to render the fields (start, end, location, link).
Please advise on how to accomplish this.
Does it have any effect if you just type “Hello” into your template? But this issue we deal with in the other thread, so let’s not mix it up.