Add cache tag for the current post

References #3
This commit is contained in:
Oliver Davies 2021-01-11 01:58:40 +00:00
parent e716069022
commit f404019a39

View file

@ -66,6 +66,7 @@ class RelatedPostsBlock extends BlockBase implements ContainerFactoryPluginInter
$build['content'] = [
'#cache' => [
'max-age' => 604800,
'tags' => ["node:{$currentPost->id()}"],
],
'#theme' => 'item_list',
'#items' => $relatedPosts