I’m trying to define three different types of articles. The idea is that in the panel there will be three tabs where the author can publish based on one of the three different topics:
- Blog
- Case-Studies
- Services
I’m unable to limit the pages to the specific topic. I have the idea that it’s possible to create one blueprint for the “article” and extend it based on the article topic. Am I right? What’s wrong with my approach?
my site blueprint looks like this.
# site.yml
title: Site
extends: layouts/default
my default layout looks like this.
# layouts/default.yml
tabs:
services:
label: Services
icon: document
extends: layouts/sections/article
case-studies:
label: Case-Studies
icon: document
extends: layouts/sections/article
blog-posts:
label: Blog Posts
icon: document
extends: layouts/sections/article
And finally the article section blueprint looks like this
# layouts/sections/article.yml
columns:
- width: 2/3
sections:
listed:
type: pages
headline: Published
status: listed
- width: 1/3
sections:
drafts:
type: pages
headline: Drafts
status: draft
unlisted:
type: pages
headline: In Review
status: unlisted
The problem is that to extend this in a useful way, you’d have to define the section separately, so that you can extend it and assign a different template to each. With your current setup, all tabs have the same setup.
So I should drop the article.yml and have three different sections?
services:
label: Services
icon: document
extends: layouts/sections/services
case-studies:
label: Case-Studies
icon: document
extends: layouts/sections/casestudies
blog-posts:
label: Blog Posts
icon: document
extends: layouts/sections/blog
Great. Not really sure what to do next…
Your sections could even extend a single section, but with different templates. I don’t have the time now to set up an example for you
, but if you have a the columns in one template, I don’t think you can easily extend it, or you would at least have to use named columns and then extend all the columns, which is probably more work then just extending a section.
I’m thinking something like this then:
# sections/services.yml
type: pages
headline: Services
info: "{{ page.date.toDate('d.m.Y') }}"
template: services
empty: No entries
sortBy: date desc
Am I supposed to extend the Page model to be able to create different article types?
No, this has nothing to do with page models. It’s just about using different blueprints for the different page types.
1 Like
Okay, not that I’ve sorta gotten what I wanted, I’ve realized that I must first create a page before I can have a subpage, and defining different articles has more to do with creating templates than record sets.
So my initial approach was flawed in my miss understanding of the Kirby CMS.
@cowglow Do you still need help with setting this up or have you managed to sort it out?