Set cache max age on related posts block

Based on https://www.drupal.org/node/2451555, added a `max-age` value to
the related posts block.

References #3
This commit is contained in:
Oliver Davies 2021-01-11 01:29:36 +00:00
parent 105405e7f9
commit 52fa58733d

View file

@ -64,6 +64,9 @@ class RelatedPostsBlock extends BlockBase implements ContainerFactoryPluginInter
}
$build['content'] = [
'#cache' => [
'max-age' => 604800,
],
'#theme' => 'item_list',
'#items' => $relatedPosts
->sortByDesc(fn(Post $post) => $post->getCreatedTime())