Thank you a lot for your help.
Maybe I should give a littel more context.
I tried to implement your solution but as far as I understand, this gives each category a fixed number.
A1, B2, C3… maybe I did it wrong
(Sorry if I repeat myself)
What I would like to do, is have a structure item of
Category A and one of
Category N and so on.
And then I would like to assign lets say 5 posts (or subpages) to
A and count how many
A posts I have and output each number like so: A1, A2, A3, A4, A5
My blueprint right now looks like this:
label: Post categories
help: Add new categories and specify abbreviation
And here my template where the
Post-Number is missing:
<?php foreach ($page->grandChildren()->listed()->sortBy('date', 'desc') as $section): ?>
<h3><span class="type"><?= $section->postCategory() ?><?= 'Post-Number?' ?></span></h3>
<?php if ($section->date()->isNotEmpty()): ?>
<h3 class="date"><?= $section->date()->toDate('d.m.y') ?></h3>
<?php endif ?>
<div class="text"><p><?= $section->text()->kirbytext()?></p></div>
<?php if ($section->contact()->isNotEmpty()): ?>
<p class="notes"><?= $section->notes()->kirbytext()?></p>
<p class="name"><?= $section->name()->kirbytext()?></p>
<p class="email"><a href="mailto:<?= $section->email()?>?subject=contact"><?= $section->email()?></a></p>
<p class="phone"><?= $section->phone()?></p>
<?php endif ?>
<?php endforeach ?>
I have a page named
Actueel and there I define my structure fields along with a subpage named
2020 has also children (blogposts) and for each of those children you can choose one of the different categories (
B and so on) in the structure field.
Am I overthinking things?
I know it would probably be easier to just have pages named
C and then create subpages.
Thank you for your time @texnixe