I’m getting this frontend error on my projects subpages
here is the full error:
Argument 1 passed to Kirby\Cms\App::file() must be of the type string, array given, called in /Applications/MAMP/htdocs/localarchitects/build/kirby/config/methods.php on line 130
This line is highlighted:
public function file(string $path, $parent = null, bool $drafts = true)
Any suggestions as to what is going on? working with kirby 3
Could you please post your template code and your blueprint?
Blueprint:
title: Project
options:
delete: true
changeTemplate: false
changeStatus: true
tabs:
project:
fields:
featured:
label: Featured
type: structure
width: 1/2
max: 3
fields:
featuredimages:
extends: fields/uploader
label: Image
Template:
<?= snippet ('head') ?>
<main>
</main>
<?= snippet ('footer') ?>
I had only gotten this far with the template
texnixe
October 22, 2020, 10:51am
4
That is weird. Is there a stacktrace for the error?
I haven’t come across this term before sorry…
I hope this helps
Looks like the error is caused in the meta.php snippet which is called in the head snippet. Could you please post that snippet.
1 Like
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<?php if($page->isHomepage()): ?>
<meta name="description" content="<?= $site->description()->html() ?>">
<meta name="og:description" content="<?= $site->description()->html() ?>">
<?php else: ?>
<?php if($page->text()->isNotEmpty()): ?>
<meta name="description" content="<?= $page->text()->excerpt(250) ?>">
<meta property="og:description" content="<?= $page->text()->excerpt(250) ?>" />
<?php else: ?>
<meta name="description" content="">
<meta property="og:description" content="" />
<?php endif ?>
<?php endif ?>
<meta name="robots" content="index,follow" />
<meta name="keywords" content="<?= $site->keywords()->html() ?>">
<meta property="og:type" content="website" />
<meta property="og:url" content="<?= html($page->url()) ?>" />
<?php if($page->featured()->isNotEmpty() && $ogimage = $page->featured()->toFile()): ?>
<?php $ogimage = $ogimage->resize(1200) ?>
<meta property="og:image" content="<?= $ogimage->url() ?>"/>
<meta property="og:image:width" content="<?= $ogimage->width() ?>"/>
<meta property="og:image:height" content="<?= $ogimage->height() ?>"/>
<?php else: ?>
<?php if($site->ogimage()->isNotEmpty() && $ogimage = $site->ogimage()->toFile()): ?>
<?php $ogimage = $ogimage->resize(1200) ?>
<meta property="og:image" content="<?= $ogimage->url() ?>"/>
<meta property="og:image:width" content="<?= $ogimage->width() ?>"/>
<meta property="og:image:height" content="<?= $ogimage->height() ?>"/>
<?php endif ?>
<?php endif ?>
I released the ‘featured’ section name was being called in the meta.php snippet so in project.yml I renamed to ‘featuredproject’ but that didn’t fix it
Seems to be this line though. If you remove it, does the error persist? Are you sure you have change the field name also in all content files, not only in the blueprint?
1 Like
The error doesn’t persist when removing those lines of code from meta.php! I should be able to fix it from here
Thank you very much for your time