124 lines
9.1 KiB
PHP
124 lines
9.1 KiB
PHP
@php
|
|
$forumMicrodata = is_array($forumMicrodata ?? null) ? $forumMicrodata : null;
|
|
@endphp
|
|
|
|
@if($forumMicrodata)
|
|
<div class="hidden" aria-hidden="true">
|
|
@if(($forumMicrodata['kind'] ?? null) === 'topic')
|
|
<div itemscope itemtype="https://schema.org/DiscussionForumPosting">
|
|
@if(!empty($forumMicrodata['canonical']))<meta itemprop="mainEntityOfPage" content="{{ $forumMicrodata['canonical'] }}" />@endif
|
|
@if(!empty($forumMicrodata['canonical']))<meta itemprop="url" content="{{ $forumMicrodata['canonical'] }}" />@endif
|
|
@if(!empty($forumMicrodata['title']))<meta itemprop="headline" content="{{ $forumMicrodata['title'] }}" />@endif
|
|
@php
|
|
$topicText = trim((string) ($forumMicrodata['text'] ?? ''));
|
|
if ($topicText === '') {
|
|
$topicText = trim((string) ($forumMicrodata['title'] ?? ''));
|
|
}
|
|
@endphp
|
|
@if($topicText !== '')<meta itemprop="text" content="{{ $topicText }}" />@endif
|
|
@if(!empty($forumMicrodata['date_published']))<meta itemprop="datePublished" content="{{ $forumMicrodata['date_published'] }}" />@endif
|
|
@if(!empty($forumMicrodata['date_modified']))<meta itemprop="dateModified" content="{{ $forumMicrodata['date_modified'] }}" />@endif
|
|
@if(isset($forumMicrodata['comment_count']))<meta itemprop="commentCount" content="{{ (int) $forumMicrodata['comment_count'] }}" />@endif
|
|
|
|
@if(!empty($forumMicrodata['author']))
|
|
<div itemprop="author" itemscope itemtype="https://schema.org/Person">
|
|
@if(!empty($forumMicrodata['author']['url']))<meta itemprop="url" content="{{ $forumMicrodata['author']['url'] }}" />@endif
|
|
@if(!empty($forumMicrodata['author']['name']))<meta itemprop="name" content="{{ $forumMicrodata['author']['name'] }}" />@endif
|
|
</div>
|
|
@endif
|
|
|
|
@if(!empty($forumMicrodata['board']))
|
|
<div itemprop="isPartOf" itemscope itemtype="https://schema.org/WebPage">
|
|
@if(!empty($forumMicrodata['board']['url']))<meta itemprop="url" content="{{ $forumMicrodata['board']['url'] }}" />@endif
|
|
@if(!empty($forumMicrodata['board']['name']))<meta itemprop="name" content="{{ $forumMicrodata['board']['name'] }}" />@endif
|
|
@if(!empty($forumMicrodata['board']['category']))
|
|
<div itemprop="isPartOf" itemscope itemtype="https://schema.org/WebPage">
|
|
@if(!empty($forumMicrodata['board']['category']['url']))<meta itemprop="url" content="{{ $forumMicrodata['board']['category']['url'] }}" />@endif
|
|
@if(!empty($forumMicrodata['board']['category']['name']))<meta itemprop="name" content="{{ $forumMicrodata['board']['category']['name'] }}" />@endif
|
|
</div>
|
|
@endif
|
|
</div>
|
|
@endif
|
|
|
|
@foreach(($forumMicrodata['interactions'] ?? []) as $interaction)
|
|
<div itemprop="interactionStatistic" itemscope itemtype="https://schema.org/InteractionCounter">
|
|
@if(!empty($interaction['type']))<meta itemprop="interactionType" content="{{ $interaction['type'] }}" />@endif
|
|
@if(isset($interaction['count']))<meta itemprop="userInteractionCount" content="{{ (int) $interaction['count'] }}" />@endif
|
|
</div>
|
|
@endforeach
|
|
|
|
@foreach(($forumMicrodata['comments'] ?? []) as $comment)
|
|
<div itemprop="comment" itemscope itemtype="https://schema.org/Comment">
|
|
@if(!empty($comment['url']))<meta itemprop="url" content="{{ $comment['url'] }}" />@endif
|
|
@if(!empty($comment['text']))<meta itemprop="text" content="{{ $comment['text'] }}" />@endif
|
|
@if(!empty($comment['date_published']))<meta itemprop="datePublished" content="{{ $comment['date_published'] }}" />@endif
|
|
@if(!empty($comment['date_modified']))<meta itemprop="dateModified" content="{{ $comment['date_modified'] }}" />@endif
|
|
|
|
@if(!empty($comment['author']))
|
|
<div itemprop="author" itemscope itemtype="https://schema.org/Person">
|
|
@if(!empty($comment['author']['url']))<meta itemprop="url" content="{{ $comment['author']['url'] }}" />@endif
|
|
@if(!empty($comment['author']['name']))<meta itemprop="name" content="{{ $comment['author']['name'] }}" />@endif
|
|
</div>
|
|
@endif
|
|
|
|
@foreach(($comment['interactions'] ?? []) as $interaction)
|
|
<div itemprop="interactionStatistic" itemscope itemtype="https://schema.org/InteractionCounter">
|
|
@if(!empty($interaction['type']))<meta itemprop="interactionType" content="{{ $interaction['type'] }}" />@endif
|
|
@if(isset($interaction['count']))<meta itemprop="userInteractionCount" content="{{ (int) $interaction['count'] }}" />@endif
|
|
</div>
|
|
@endforeach
|
|
</div>
|
|
@endforeach
|
|
</div>
|
|
@elseif(($forumMicrodata['kind'] ?? null) === 'collection')
|
|
<div itemscope itemtype="https://schema.org/CollectionPage">
|
|
@if(!empty($forumMicrodata['canonical']))<meta itemprop="url" content="{{ $forumMicrodata['canonical'] }}" />@endif
|
|
@if(!empty($forumMicrodata['name']))<meta itemprop="name" content="{{ $forumMicrodata['name'] }}" />@endif
|
|
@if(!empty($forumMicrodata['description']))<meta itemprop="description" content="{{ $forumMicrodata['description'] }}" />@endif
|
|
|
|
<div itemprop="mainEntity" itemscope itemtype="https://schema.org/ItemList">
|
|
@if(!empty($forumMicrodata['list_name']))<meta itemprop="name" content="{{ $forumMicrodata['list_name'] }}" />@endif
|
|
|
|
@foreach(($forumMicrodata['items'] ?? []) as $index => $item)
|
|
@php
|
|
$itemType = $item['type'] ?? 'WebPage';
|
|
$itemText = trim((string) ($item['text'] ?? ''));
|
|
$itemAuthor = $item['author'] ?? null;
|
|
|
|
if ($itemType === 'DiscussionForumPosting') {
|
|
if ($itemText === '') {
|
|
$itemText = trim((string) ($item['description'] ?? $item['title'] ?? ''));
|
|
}
|
|
|
|
if (empty($itemAuthor)) {
|
|
$fallbackAuthorName = trim((string) ($item['uname'] ?? $item['author_name'] ?? ''));
|
|
if ($fallbackAuthorName !== '') {
|
|
$itemAuthor = ['name' => $fallbackAuthorName];
|
|
}
|
|
}
|
|
}
|
|
@endphp
|
|
<div itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem">
|
|
<meta itemprop="position" content="{{ $index + 1 }}" />
|
|
<div itemprop="item" itemscope itemtype="https://schema.org/{{ $itemType }}">
|
|
@if(!empty($item['url']))<meta itemprop="url" content="{{ $item['url'] }}" />@endif
|
|
@if(!empty($item['title']))<meta itemprop="{{ $itemType === 'DiscussionForumPosting' ? 'headline' : 'name' }}" content="{{ $item['title'] }}" />@endif
|
|
@if(!empty($item['description']))<meta itemprop="description" content="{{ $item['description'] }}" />@endif
|
|
@if(!empty($itemText))<meta itemprop="text" content="{{ $itemText }}" />@endif
|
|
@if(!empty($item['date_published']))<meta itemprop="datePublished" content="{{ $item['date_published'] }}" />@endif
|
|
@if(isset($item['comment_count']))<meta itemprop="commentCount" content="{{ (int) $item['comment_count'] }}" />@endif
|
|
@if(!empty($item['date_modified']))<meta itemprop="dateModified" content="{{ $item['date_modified'] }}" />@endif
|
|
@if(!empty($itemAuthor))
|
|
<div itemprop="author" itemscope itemtype="https://schema.org/Person">
|
|
@if(!empty($itemAuthor['url']))<meta itemprop="url" content="{{ $itemAuthor['url'] }}" />@endif
|
|
@if(!empty($itemAuthor['name']))<meta itemprop="name" content="{{ $itemAuthor['name'] }}" />@endif
|
|
</div>
|
|
@endif
|
|
</div>
|
|
</div>
|
|
@endforeach
|
|
</div>
|
|
</div>
|
|
@endif
|
|
</div>
|
|
@endif |