@php
$isSearch = $query !== '';
$siteSeoTitle = $platformSiteSettings?->effectiveSeoTitle() ?: ($platformSiteSettings?->effectiveSiteName() ?? 'qpost platform');
$siteSeoDescription = $platformSiteSettings?->effectiveSeoDescription() ?: ($platformSiteSettings?->site_description ?? '새 글과 추천 채널');
$siteSeoKeywords = $platformSiteSettings?->effectiveSeoKeywords() ?: '';
$siteSeoCanonicalUrl = rtrim(url()->current(), '/') . '/';
$siteSeoOgTitle = $platformSiteSettings?->effectiveSeoOgTitle() ?: $siteSeoTitle;
$siteSeoOgDescription = $platformSiteSettings?->effectiveSeoOgDescription() ?: $siteSeoDescription;
$siteSeoOgImage = $platformSiteSettings?->effectiveSeoOgImageUrl() ?: '';
@endphp
@extends('components.layouts.platform-home', ['platformSiteSettings' => $platformSiteSettings ?? null])
@section('title', $isSearch ? '[' . $query . '] 검색결과' : $siteSeoTitle)
@section('meta-description', $isSearch ? '검색 결과 페이지' : $siteSeoDescription)
@if (! $isSearch && $siteSeoKeywords !== '')
@section('meta-keywords', $siteSeoKeywords)
@endif
@section('canonical-url', $isSearch ? url()->current() : $siteSeoCanonicalUrl)
@section('og-title', $isSearch ? '[' . $query . '] 검색결과' : $siteSeoOgTitle)
@section('og-description', $isSearch ? '검색 결과 페이지' : $siteSeoOgDescription)
@if (! $isSearch && $siteSeoOgImage !== '')
@section('og-image', $siteSeoOgImage)
@endif
@section('og-type', 'website')
@section('meta-robots', $isSearch ? 'noindex,follow' : (($platformSiteSettings?->indexable ?? true) ? 'index,follow' : 'noindex,follow'))
@section('content')
@if ($query !== '')
@if (($searchResults?->count() ?? 0) > 0)
총 {{ number_format($resultCount) }}개 결과
@foreach ($searchResults as $post)
@endforeach
@else
@endif
@else
@if ($heroPosts->isEmpty())
@else
@foreach ($compactPosts->take(4)->values() as $post)
@endforeach
@endif
@endif
@if ($query === '')
@php
$visibleTrendItems = collect($trendItems)
->filter(function ($trendItem) {
return collect(data_get($trendItem, 'data.news_items', []))
->filter(function ($newsItem) {
return trim((string) data_get($newsItem, 'title', '')) !== '';
})
->isNotEmpty();
})
->values();
@endphp
@if ($visibleTrendItems->isEmpty())
@else
{{-- 태그 목록 --}}
{{-- 관련 기사 Swiper --}}
@foreach ($visibleTrendItems as $trendIndex => $trendItem)
@php
$trendData = $trendItem->data ?? [];
$newsItems = collect(
data_get($trendData, 'news_items', [])
);
$trendUrl = data_get($trendData, 'link')
?: 'https://trends.google.co.kr/trending/rss?geo=KR';
$approxTraffic = trim(
(string) data_get($trendData, 'approx_traffic', '')
);
@endphp
@if ($newsItems->isEmpty())
표시할 관련 기사가 없습니다.
@else
@foreach ($newsItems->take(3) as $newsItem)
@php
$newsUrl = trim(
(string) data_get($newsItem, 'url', '')
);
$newsTitle = trim(
(string) data_get($newsItem, 'title', '')
);
$newsSnippet = trim(
(string) data_get($newsItem, 'snippet', '')
);
$newsSource = trim(
(string) data_get($newsItem, 'source', '')
);
$newsPicture = trim(
(string) (
data_get($newsItem, 'picture')
?: data_get($newsItem, 'picture_url')
)
);
@endphp
@if ($newsTitle !== '')
{{ $newsTitle }}
@if ($newsSnippet !== '')
{{ $newsSnippet }}
@endif
{{ $newsSource !== '' ? $newsSource : 'Google Trends' }}
@if ($approxTraffic !== '')
·
{{ $approxTraffic }} 검색
@endif
@if ($newsPicture !== '')
@endif
@endif
@endforeach
@endif
@endforeach
@endif
@endif
@endsection