mirror of
https://github.com/torrentpier/torrentpier
synced 2025-07-05 20:41:41 -07:00
feat(meta): Minor improvements to description generation (#1926)
This commit is contained in:
parent
2487d130bb
commit
4d0b2941e3
3 changed files with 5 additions and 3 deletions
|
@ -123,7 +123,7 @@ $template->assign_vars([
|
|||
|
||||
'USE_TABLESORTER' => !empty($page_cfg['use_tablesorter']),
|
||||
'ALLOW_ROBOTS' => !$bb_cfg['board_disable'] && (!isset($page_cfg['allow_robots']) || $page_cfg['allow_robots'] === true),
|
||||
'META_DESCRIPTION' => $page_cfg['meta_description'] ?? '',
|
||||
'META_DESCRIPTION' => !empty($page_cfg['meta_description']) ? trim(htmlCHR($page_cfg['meta_description'])) : '',
|
||||
|
||||
'SITENAME' => $bb_cfg['sitename'],
|
||||
'U_INDEX' => BB_ROOT . 'index.php',
|
||||
|
|
|
@ -53,7 +53,7 @@ if (!$forum_id or !$forum_data = @$forums['forum'][$forum_id]) {
|
|||
|
||||
// Set meta description
|
||||
if (!empty($forum_data['forum_desc'])) {
|
||||
$page_cfg['meta_description'] = htmlCHR($forum_data['forum_desc']);
|
||||
$page_cfg['meta_description'] = $forum_data['forum_desc'];
|
||||
}
|
||||
|
||||
// Make jumpbox
|
||||
|
|
|
@ -673,7 +673,9 @@ for ($i = 0; $i < $total_posts; $i++) {
|
|||
|
||||
// Set meta description
|
||||
if ($is_first_post || $i == 0) {
|
||||
$page_cfg['meta_description'] = str_short(str_replace("\n", ' ', strip_tags(br2nl($message))), 220);
|
||||
$message_meta = preg_replace('#<br\s*/?>\s*#si', ' ', $message);
|
||||
$message_meta = str_replace(' ', '', $message_meta);
|
||||
$page_cfg['meta_description'] = str_short(strip_tags($message_meta), 220);
|
||||
}
|
||||
|
||||
$template->assign_block_vars('postrow', [
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue