Site()->index() including site() itself?

How can I get a collection of all pages including the site itself?

site() or $kirby->site() does not return a Page object, but the Site object. Hence it cannot be part of a Pages collection. What are you trying to achieve? site->index() should include all (published) pages of your site.

Thanks @sebastiangreger :slight_smile:

Iā€™m trying to loop through all content for translation import/export, including the content stored in site.txt. I was hoping to to be able to merge site and index but it looks like site may need some special treatment.

There is an example script here: Import and export translations | Kirby CMS

You only would have to add the site and possibly site files in an additional step. And we should probably extend the script to include this.

1 Like