diff --git a/README.md b/README.md index 0a7ab28..5b56427 100644 --- a/README.md +++ b/README.md @@ -69,6 +69,7 @@ In addition, entities contain contextual methods, as follows: * `next` get next post * `prev` get previous post * `image` get post image +* `thumbnail` get post thumbnail (defined under Settings->Assets->Image Transforms->Blog Thumbnail) * `excerpt` get post excerpt * `content` get post content (supports Matrix field rendering. See below) diff --git a/src/behaviors/PostFieldsBehavior.php b/src/behaviors/PostFieldsBehavior.php index a093cf5..2fae01e 100644 --- a/src/behaviors/PostFieldsBehavior.php +++ b/src/behaviors/PostFieldsBehavior.php @@ -17,6 +17,10 @@ public function getImage() return $this->owner->blogifyPostImage->one(); } + public function thumbnail() { + return $this->getImage()->setTransform(Handles::THUMBNAIL_TRANSFORM); + } + public function getExcerpt() { return $this->owner->blogifyPostExcerpt; diff --git a/src/templates/blogify/_partials/postThumbnail.twig b/src/templates/blogify/_partials/postThumbnail.twig deleted file mode 100644 index ca93dc2..0000000 --- a/src/templates/blogify/_partials/postThumbnail.twig +++ /dev/null @@ -1,4 +0,0 @@ -{% do image.setTransform('blogifyThumbnail') %} - \ No newline at end of file diff --git a/src/templates/blogify/filters/_partials/postsList.twig b/src/templates/blogify/filters/_partials/postsList.twig index be01644..9d922e5 100644 --- a/src/templates/blogify/filters/_partials/postsList.twig +++ b/src/templates/blogify/filters/_partials/postsList.twig @@ -7,26 +7,27 @@