rss yandex except obyavlenie

This commit is contained in:
merdan 2021-10-11 13:16:01 +05:00
parent ffdc7c0a80
commit 2a8ebbbe8e
2 changed files with 20 additions and 7 deletions

View File

@ -82,15 +82,24 @@ class RssFeed extends ComponentBase
'title' => 'Source',
'description' => 'Source google, yandex',
'type' => 'dropdown',
'default' => 'google',
'default' => 'google',
],
'exceptCategories' => [
'title' => 'rainlab.blog::lang.settings.posts_except_categories',
'description' => 'rainlab.blog::lang.settings.posts_except_categories_description',
'type' => 'string',
'validationPattern' => '^[a-z0-9\-_,\s]+$',
'validationMessage' => 'rainlab.blog::lang.settings.posts_except_categories_validation',
'default' => '',
'group' => 'rainlab.blog::lang.settings.group_exceptions',
]
];
}
public function getSourceOptions(){
return ['google'=>'google','yandex'=>'yandex'];
return ['google'=>'google','yandex'=>'yandex'];
}
public function getBlogPageOptions()
{
return Page::sortBy('baseFileName')->lists('baseFileName', 'baseFileName');
@ -132,7 +141,7 @@ $this->page['language'] = \App::getLocale();
$this->page['rssLink'] = $this->currentPageUrl();
//Carbon::setLocale('en');
}
protected function listPosts()
@ -142,10 +151,13 @@ $this->page['language'] = \App::getLocale();
/*
* List all the posts, eager load their categories
*/
$posts = BlogPost::with('categories')->listFrontEnd([
$posts = BlogPost::listFrontEnd([
'sort' => $this->property('sortOrder'),
'perPage' => $this->property('postsPerPage'),
'category' => $category
'category' => $category,
'exceptCategories' => is_array($this->property('exceptCategories'))
? $this->property('exceptCategories')
: preg_split('/,\s*/', $this->property('exceptCategories'), -1, PREG_SPLIT_NO_EMPTY),
]);
/*

View File

@ -20,4 +20,5 @@ postsPerPage = 20
blogPage = "index"
postPage = "post"
source = "yandex"
==
exceptCategories = "obyavlenie"
==