From d4668355a86ff10b7bbb9759f2349b85bf4a2c0e Mon Sep 17 00:00:00 2001 From: merdan Date: Mon, 11 Oct 2021 18:19:31 +0500 Subject: [PATCH] rss yandex full text remove image --- plugins/rainlab/blog/components/RssFeed.php | 2 +- .../rainlab/blog/components/rssfeed/google.htm | 8 ++++---- .../rainlab/blog/components/rssfeed/yandex.htm | 17 +++++++++-------- plugins/rainlab/blog/models/Post.php | 3 +++ 4 files changed, 17 insertions(+), 13 deletions(-) diff --git a/plugins/rainlab/blog/components/RssFeed.php b/plugins/rainlab/blog/components/RssFeed.php index 49bf971de..0f161830c 100644 --- a/plugins/rainlab/blog/components/RssFeed.php +++ b/plugins/rainlab/blog/components/RssFeed.php @@ -151,7 +151,7 @@ $this->page['language'] = \App::getLocale(); /* * List all the posts, eager load their categories */ - $posts = BlogPost::listFrontEnd([ + $posts = BlogPost::with('categories')->listFrontEnd([ 'sort' => $this->property('sortOrder'), 'perPage' => $this->property('postsPerPage'), 'category' => $category, diff --git a/plugins/rainlab/blog/components/rssfeed/google.htm b/plugins/rainlab/blog/components/rssfeed/google.htm index 0f8ecfa18..2614bac8c 100644 --- a/plugins/rainlab/blog/components/rssfeed/google.htm +++ b/plugins/rainlab/blog/components/rssfeed/google.htm @@ -13,10 +13,10 @@ {{ post.url }} {{ post.url }} {{ post.rss_date }} - {{ post.summary|raw}} ]]> - + + diff --git a/plugins/rainlab/blog/components/rssfeed/yandex.htm b/plugins/rainlab/blog/components/rssfeed/yandex.htm index 62bc90331..37ef3ad05 100644 --- a/plugins/rainlab/blog/components/rssfeed/yandex.htm +++ b/plugins/rainlab/blog/components/rssfeed/yandex.htm @@ -1,6 +1,6 @@ {{ this.page.meta_title ?: this.page.title }}{% if category %}:{{category.name}}{% endif %} @@ -8,19 +8,20 @@ {{ this.page.meta_description ?: this.page.description }} {{language}} - + {% for post in posts %} {{ post.title }} {{ post.url }} + {{ post.url }} + article + {{post.categories.first.name}} {{ post.url }} {{post.rss_date}} - {{ post.summary|raw}} ]]> - - + + + {% endfor %} - \ No newline at end of file + diff --git a/plugins/rainlab/blog/models/Post.php b/plugins/rainlab/blog/models/Post.php index 22a6ecdb2..d3c9427eb 100644 --- a/plugins/rainlab/blog/models/Post.php +++ b/plugins/rainlab/blog/models/Post.php @@ -481,6 +481,9 @@ class Post extends Model return Html::limit($content, 280); } + public function getFullTextAttribute(){ + return preg_replace("/]+\>/i", " ", $this->content_html); + } public function getTranslatedPostAttribute(){ if($this->locale === 'en') return $this->id_ru;