<url> malformed

Hi,

I would like to make more “Feed” page from differentes RSS
(I add a Rss property in .txt, and use $this->rss() in models/rssfeed.php)
I can manage Kirby page with folder and files, it’s work !
But when I try to add page from the panel, if I choose Feed in model, I have
’ malformed’ on save.

My site.yml is like this

    title: Site <- oops

    columns:
      - width: 1/2
        sections:
          posts: sections/posts
          trucs:
            type: fields
            fields:
              toggle:
                label: Toggle
                type: toggle
                text: Something ?  

      - width: 1/2
          sections:
            pages:
              type: pages
              templates:
                - album
                - default
                - posts
                - rssfeed

I remove RSS childrens links pages. I think there is no virtual pages.
What’s wrong ?

Hm, I think I’m missing something here but I don’t quite know what. What is this about RSS property iin.txtand how does it relate to your blueprint? Apart from the fact that your have a section that lists pages with therssfeed` template.

Thank you, here is the console log :slight_smile:

1. code: 3
2. exception: "Exception"
3. file: "kirby/src/Http/Remote.php"
4. line: 229
5. message: "<url> malformed"
6. route: "site/children"
7. status: "error"

and my “models”, if I rename it, no malformed message

class RssfeedPage extends Page {

    public function children()
    {
        $results = [];
        $pages   = [];
        $request = Remote::get($this->rss());

        // if the request was sucessfully, parse feed as $results
        if ($request->code() === 200) {
            $results = Xml::parse($request->content());
        }

        // if we have any results, create the child page props for each result
        if (count($results) > 0) {
            foreach ($results['channel']['item'] as $item) {
                $cat = is_array($item['category']) ? implode(', ', $item['category']) : $item['category'];

                $pages[] = [
                    'slug'     => Str::slug($item['title']),
                    'template' => 'feeditem',
                    'model'    => 'feeditem',
                    'content'  => [
                        'title'       => $item['title'],
                        'date'        => $item['pubDate'] ?? '',
                        'description' => $item['description'] ?? '',
                        'link'        => $item['link'] ?? '',
                        'categories'  => $cat, 
                        'author'      => $item['dccreator'] ?? '',
                        'enclosure'   => $item['enclosure']['@attributes']['url'] ?? '',
                    ]
                ];
            }
        }

        // create a Pages collection for the child pages
        return Pages::factory($pages, $this);
    }

}

This is a factory problems, may be, I don’t really need virtuals childrens links ; I can deal with Pages::anotherWordIdontKnow($pages) to uses array like kirby field ?

And what is stored in your rss field? Seems that you don’t have a valid URL stored there.

How can I have a valid URL on “add page” step in the panel ?

For now I made a models with no children term (function rssData) that return an array and deal with that.

I’m afraid I don’t quite understand your question. You don’t add a URL when creating a new page but a slug.

The error message you get is caused by this line:

That’s why I asked what $this->rss() is? It must be a field value, but what is stored there?

OK, I don’t understand all Kirby Class, children is reserved ?
RSS will be fill after adding a page and choose “feed” models so
As I understand with your help @texnixe

$request = Remote::get($this->rss());

Just do this trick :
$request = Remote::get($this->rss()->or('https://any.fr/rss')); :neutral_face: