From 12cbce0322adbb72323ea6fbe09aee2c15c90c44 Mon Sep 17 00:00:00 2001 From: Roman Kelesidis Date: Sat, 31 May 2025 09:58:18 +0300 Subject: [PATCH] Update viewtopic.php --- viewtopic.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/viewtopic.php b/viewtopic.php index 90a2a13f6..ab4e34e6e 100644 --- a/viewtopic.php +++ b/viewtopic.php @@ -116,9 +116,6 @@ $topic_attachment = isset($t_data['topic_attachment']) ? (int)$t_data['topic_att // Allow robots indexing $page_cfg['allow_robots'] = (bool)$t_data['topic_allow_robots']; -// Set meta description -$page_cfg['meta_description'] = ''; - if ($t_data['allow_porno_topic'] && bf($userdata['user_opt'], 'user_opt', 'user_porn_forums')) { bb_die($lang['ERROR_PORNO_FORUM']); } @@ -674,6 +671,11 @@ for ($i = 0; $i < $total_posts; $i++) { $is_first_post = ($post_id == $t_data['topic_first_post_id']); + // Set meta description + if ($i == 0) { + $page_cfg['meta_description'] = str_short(str_replace("\n", ' ', strip_tags(br2nl($message))), 220); + } + $template->assign_block_vars('postrow', [ 'ROW_CLASS' => !($i % 2) ? 'row1' : 'row2', 'POST_ID' => $post_id,