Only show posts with publish dates in the past


I want to show the latest news posts on my homepage, but only those with a publish date that is not in the future. This is what I have now:

<?php foreach ($articles = $site->children()->listed()->filterBy('template', 'post')->sortBy('date', 'desc')->paginate(50) as $page): ?>


You need to filter them, there is example in the docs

// fetch children with a date in the past
$items = $page->children()->filter(function ($child) {
  return $child->date()->toDate() < time();

thanks @jimbobrjames !