Hi,
I have a (minimal) blueprint for a blog page - basically only
title: Blog
preset: pages
however, on this page, when I click “add new” in the panel, only the template “Blog” is selected, and the select is disabled.
I have existing subpages in the content directory /content/blog/1_article-a/blogpost.txt
and a blueprint for the blogpost template:
title: Blog-Post
preset: page
fields:
headline:
label: Überschrift
type: text
summary:
label: Zusammenfassung
type: textarea
body:
label: Inhalt
type: textarea
date_start:
label: Veröffentlicht ab
type: date
width: 1/3
date_end:
label: Veröffentlicht bis
type: date
width: 1/3
url:
label: Link
type: url
width: 1/3
projects:
label: Projekt-Bezug
type: pages
query: site.find('projects').children.template('project')
layout: cards
image:
ratio: 3/1
those pages work as expected, only I cannot add a new blogpost via the panel.
Strangely a similar setup for project/projects in the same install works fine:
Projects blueprint:
title: Projects Page
preset: page
pages: project
limit: 50
files: false
fields:
competences:
label: Kompetenzen
type: tags
Project blueprint:
title: Project Page
preset: page
pages: false
files:
layout: cards
fields:
client:
label: Kunde
type: text
project:
label: Projekt
type: text
width: 1/2
url:
label: Link
type: url
width: 1/2
competences:
label: Kompetenzen
type: tags
accept: options
options: query
query: site.find("projects").competences.split
ended:
label: Status
type: toggle
text: Beendet
width: 1/3
date_start:
label: Projektbeginn
type: date
when:
ended: true
width: 1/3
date_end:
label: Projektende
type: date
when:
ended: true
width: 1/3
I have a controller for “blog”, but this should not influence the panel?
controllers/blog.php
return function ($site,$page) {
// set htmltitle
$title = $page->title() . ' - ' . $site->title();
// fetch items for hero-slider
$heroSlides = [];
$heroIntro = page('projects')->find('intro');
$heroSlides = page('home/projects')->active_projects()->toPages()->shuffle();
$heroSlides->prepend($heroIntro);
$articles = $page->children()->listed();
$articlesPublished = $articles->filter(function($child){
$now = time();
$start = $child->date_start()->toDate();
$end = $child->date_end()->toDate();
if (!empty($end) && $end < $now || !empty($start) && $start > $now) {
return false;
} else {
return $child;
}
});
$articlesSorted = $articlesPublished->sortBy(function ($child) {
return $child->date_start()->toDate();
}, 'desc');
return [
'articles' => $articlesSorted,
'htmltitle' => $title,
'heroSlides' => $heroSlides
];
}
(yeah I know, there’s still room for improvement
But I’m at a loss regarding the template of the blog posts…
cheers,
Tom