opengraph

This commit is contained in:
merdan 2021-05-21 18:27:57 +05:00
parent 9082150845
commit a2fe3bed62
4 changed files with 23 additions and 4 deletions

View File

@ -85,6 +85,12 @@ class Posts extends ComponentBase
'type' => 'string',
'default' => '',
],
'featured' => [
'title' => 'Featured posts',
'description' => 'Filter featured posts',
'type' => 'checkbox',
],
'postsPerPage' => [
'title' => 'rainlab.blog::lang.settings.posts_per_page',
'type' => 'string',
@ -206,6 +212,7 @@ class Posts extends ComponentBase
'page' => $this->property('pageNumber'),
'sort' => $this->property('sortOrder'),
'perPage' => $this->property('postsPerPage'),
'featured' => $this->property('featured'),
'search' => trim(input('q')),
'category' => $category,
'date' => input('date'),

View File

@ -272,7 +272,8 @@ class Post extends Model
'date' => '',
'published' => true,
'exceptPost' => null,
'select' => null
'select' => null,
'featured' => null
], $options));
$searchableFields = ['title', 'slug', 'excerpt'];
@ -281,6 +282,9 @@ class Post extends Model
$query->isPublished();
}
if($featured){
$query-> where('featured',1);
}
$date = trim($date);
if(strtotime($date)){

View File

@ -56,7 +56,6 @@ random = 0
<section class="hero">
<div class="auto__container">
<div class="hero__inner">
{% partial 'slider' %}
</div>
</div>

View File

@ -7,12 +7,21 @@ noPostsMessage = "No posts found"
sortOrder = "published_at desc"
categoryPage = "category"
postPage = "post"
[blogPosts featuredPosts]
pageNumber = "{{ :page }}"
postsPerPage = 8
noPostsMessage = "No posts found"
sortOrder = "published_at desc"
categoryPage = "category"
postPage = "post"
featured = 1
==
<div class="marquee">
<a href="#" class="marquee__link">
Главное
{{'Главное'|_}}
</a>
<div>{% for post in posts %} <span>{{post.title}}</span> {% endfor %}</div>
<div>{% for post in featuredPosts %} <a href="{{'post'|page({id:post.id,slug:post.slug})}}">{{post.title}}</a> {% endfor %}</div>
</div>
<div class="swiper-container mySwiper">
<div class="swiper-wrapper">