Difference between pages and site object

whats the difference between Pages and Site object?

especially utilizing the find() method to get a single page object seems to give exactly same result

whats are the most common goals when choosing one or the other?

Speed mostly. If you var_dump each one, you’ll see the difference. As i recall$site includes everything, pages, files, etc. where as $pages is just the pages, but you can get to the other stuff through those.

$site->index()->find('yourpage') is probably a little slower then $pages->find('your-page') since your starting out with a bigger set of data to find the page in, and doing an extra step to get to it.

$site and $pages are different classes, the fact, that there is a find() method that runs through the `site’s children doesn’t mean it is the same.

The $site object is the root element for any site with pages. It represents the main content folder with its site.txt .

The $pages object refers to a collection of pages. The pages in this collection can have the same or different parents, they can actually exist as subfolders in the content folder or be virtual pages created from a database, an Excel sheet, any API or any other source.

thanks both

$site->index()->find() is something else than $site-find() as $site->find() only goes through the site’s children, not the complete index, so there is no difference performance-wise between $site->find() and $pages->find() as long as $pages refers to the the collection of first level pages.