Update (keywords): new logic

This commit is contained in:
2023-11-23 02:15:41 +08:00
parent d2c2059531
commit b2762ecef2
15 changed files with 211 additions and 198 deletions

View File

@@ -101,3 +101,7 @@ @keyframes shimmer {
background-position: -400% 0;
}
}
.word-wrap-break-word {
word-wrap: break-word;
}

View File

@@ -12,16 +12,18 @@
<div class="d-flex flex-wrap mb-1">
@if ($post->entities)
@foreach ($post->entities as $key => $keyword)
@if ($key == 0)
<h4
class="mb-1 pb-1 d-inline badge bg-secondary border-secondary text-white border me-1 small fw-bold">
{{ $keyword }}
</h4>
@else
<h4 class="mb-1 pb-1 d-inline badge text-bg-light border me-1 small fw-normal">
{{ $keyword }}
</h4>
@foreach ($post->entities_keywords as $keyword)
@if($keyword->type == 'entity')
@if ($keyword->is_main)
<h4
class="mb-1 pb-1 d-inline badge bg-secondary border-secondary text-white border me-1 small fw-bold">
{{ $keyword->value }}
</h4>
@else
<h4 class="mb-1 pb-1 d-inline badge text-bg-light border me-1 small fw-normal">
{{ $keyword->value }}
</h4>
@endif
@endif
@endforeach
@endif
@@ -40,12 +42,12 @@ class="font-family-roboto-condensed mb-1 pb-1 d-inline badge bg-danger border-da
@endif
<span class="d-inline text-secondary small">
@if($post->published_at->isBetween(now()->subDays(1), now()))
{{ $post->published_at->diffForHumans() }}
@else
{{ $post->published_at->format('d M') }}
@endif
@if ($post->published_at->isBetween(now()->subDays(1), now()))
{{ $post->published_at->diffForHumans() }}
@else
{{ $post->published_at->format('d M') }}
@endif
</span>
<i class="bi bi-dot"></i>
<span class="d-inline text-secondary small">{{ min_read($post->bites) }}</span>
@@ -68,10 +70,10 @@ class="font-family-roboto-condensed mb-1 pb-1 d-inline badge bg-danger border-da
</div>
@endif
@if ($post->entities)
<div class="mb-2">
More about: @foreach ($post->all_keywords as $keyword)
<a class="ms-1"
href="{{ get_route_search_result($keyword) }}">{{ $keyword }}</a>
<div class="mb-2 text-wrap">
More about: @foreach ($post->entities_keywords as $keyword)
<a class="word-wrap-break-word ms-2"
href="{{ get_route_search_result($keyword->value_lowercased) }}">#{{ $keyword->value_lowercased }}</a>
@endforeach
</div>
@endif

View File

@@ -1,8 +1,7 @@
<aside>
<form class="d-flex mb-3" action="{{ route('front.search') }}" method="POST">
@csrf
<input name="query" class="form-control me-2" type="search" placeholder="Type a keyword..."
aria-label="Search">
<input name="query" class="form-control me-2" type="search" placeholder="Type a keyword..." aria-label="Search">
<button class="btn btn-outline-dark border-2" type="submit">
<i class="bi bi-search"></i> Search
</button>