param('slug'))->first();
if (!$record) {
return;
}
$description = trim(preg_replace('/\s+/', ' ', strip_tags($record->content ?? '')));
if ($description === '') {
$description = $record->title;
}
if (function_exists('mb_strlen') && mb_strlen($description) > 180) {
$description = mb_substr($description, 0, 180) . '...';
} elseif (strlen($description) > 180) {
$description = substr($description, 0, 180) . '...';
}
$this['seo'] = [
'title' => $record->title,
'description' => $description,
'keywords' => '',
'image' => null,
'type' => 'website',
];
$canonicalPath = \Cms\Classes\Page::url($this->page->baseFileName, ['slug' => $record->slug], false);
$canonicalUrl = \Url::to($canonicalPath);
$publisher = [
'@type' => 'Organization',
'name' => 'Alfraganus University',
'url' => 'https://afu.uz',
];
$periodical = [
'@type' => 'Periodical',
'name' => 'Academic Research in Educational Sciences',
'issn' => '2181-1385',
'publisher' => $publisher,
'url' => url('/'),
];
$jsonLd = [
'@context' => 'https://schema.org',
'@type' => 'PublicationIssue',
'name' => $record->title,
'description' => $description,
'datePublished' => $record->created_at ? $record->created_at->format('c') : null,
'publisher' => $publisher,
'isPartOf' => $periodical,
'url' => $canonicalUrl,
'inLanguage' => \App::getLocale(),
'isAccessibleForFree' => true,
];
$this['seoJsonLd'] = json_encode($jsonLd, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);
}
?>