Ok. But I don’t create the pages in this structure field.
The file looks like this:
label: Inhaltsverzeichnis
type: structure
icon: list-numbers
fields:
inhaltsseite:
label: Inhaltsseite
type: select
options: query
query: site.children.published
kapitel: fields/kapitel
url: fields/urlverzeichnis
``
So, is your way then also possible?
<?php
// replace structurefieldname with name of your field, it's missing from your blueprint definition above
$items = $page->structurefieldname()->toStructure();
foreach ( $items as $item ) :
if ( $p = $item->inhaltsseite()->toPage() ):
// from here on, you have a page object and can get all its props
echo $page->title();
echo $page->url();
endif;
endforeach;
?>