mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-14 02:27:34 -07:00
feat: Added ability to set page meta description (#1917)
* feat: Added ability to set page meta description * Update page_header.php * Update viewforum.php * Updated * Update viewtopic.php * Update viewtopic.php * Update viewtopic.php * Update viewtopic.php
This commit is contained in:
parent
5a60ee0193
commit
7b8b9a0bba
5 changed files with 19 additions and 0 deletions
|
@ -45,6 +45,9 @@ if ($bb_cfg['show_network_news']) {
|
||||||
// Init userdata
|
// Init userdata
|
||||||
$user->session_start();
|
$user->session_start();
|
||||||
|
|
||||||
|
// Set meta description
|
||||||
|
$page_cfg['meta_description'] = $bb_cfg['site_desc'];
|
||||||
|
|
||||||
// Init main vars
|
// Init main vars
|
||||||
$viewcat = isset($_GET[POST_CAT_URL]) ? (int)$_GET[POST_CAT_URL] : 0;
|
$viewcat = isset($_GET[POST_CAT_URL]) ? (int)$_GET[POST_CAT_URL] : 0;
|
||||||
$lastvisit = IS_GUEST ? TIMENOW : $userdata['user_lastvisit'];
|
$lastvisit = IS_GUEST ? TIMENOW : $userdata['user_lastvisit'];
|
||||||
|
|
|
@ -123,6 +123,7 @@ $template->assign_vars([
|
||||||
|
|
||||||
'USE_TABLESORTER' => !empty($page_cfg['use_tablesorter']),
|
'USE_TABLESORTER' => !empty($page_cfg['use_tablesorter']),
|
||||||
'ALLOW_ROBOTS' => !$bb_cfg['board_disable'] && (!isset($page_cfg['allow_robots']) || $page_cfg['allow_robots'] === true),
|
'ALLOW_ROBOTS' => !$bb_cfg['board_disable'] && (!isset($page_cfg['allow_robots']) || $page_cfg['allow_robots'] === true),
|
||||||
|
'META_DESCRIPTION' => $page_cfg['meta_description'] ?? '',
|
||||||
|
|
||||||
'SITENAME' => $bb_cfg['sitename'],
|
'SITENAME' => $bb_cfg['sitename'],
|
||||||
'U_INDEX' => BB_ROOT . 'index.php',
|
'U_INDEX' => BB_ROOT . 'index.php',
|
||||||
|
|
|
@ -5,6 +5,11 @@
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=Edge">
|
<meta http-equiv="X-UA-Compatible" content="IE=Edge">
|
||||||
<meta name="viewport" content="initial-scale=1.0">
|
<meta name="viewport" content="initial-scale=1.0">
|
||||||
<meta name="generator" content="{#APP_NAME#}">
|
<meta name="generator" content="{#APP_NAME#}">
|
||||||
|
<!-- IF META_DESCRIPTION -->
|
||||||
|
<meta name="description" content="{META_DESCRIPTION}"/>
|
||||||
|
<meta property="og:description" content="{META_DESCRIPTION}">
|
||||||
|
<meta property="twitter:description" content="{META_DESCRIPTION}">
|
||||||
|
<!-- ENDIF -->
|
||||||
<title><!-- IF HAVE_NEW_PM -->({HAVE_NEW_PM}) <!-- ENDIF --><!-- IF PAGE_TITLE -->{PAGE_TITLE} :: {SITENAME}<!-- ELSE -->{SITENAME}<!-- ENDIF --></title>
|
<title><!-- IF HAVE_NEW_PM -->({HAVE_NEW_PM}) <!-- ENDIF --><!-- IF PAGE_TITLE -->{PAGE_TITLE} :: {SITENAME}<!-- ELSE -->{SITENAME}<!-- ENDIF --></title>
|
||||||
<meta name="apple-mobile-web-app-title" content="{SITENAME}">
|
<meta name="apple-mobile-web-app-title" content="{SITENAME}">
|
||||||
<meta name="application-name" content="{SITENAME}"/>
|
<meta name="application-name" content="{SITENAME}"/>
|
||||||
|
|
|
@ -51,6 +51,11 @@ if (!$forum_id or !$forum_data = @$forums['forum'][$forum_id]) {
|
||||||
bb_die($lang['FORUM_NOT_EXIST']);
|
bb_die($lang['FORUM_NOT_EXIST']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Set meta description
|
||||||
|
if (!empty($forum_data['forum_desc'])) {
|
||||||
|
$page_cfg['meta_description'] = $forum_data['forum_desc'];
|
||||||
|
}
|
||||||
|
|
||||||
// Make jumpbox
|
// Make jumpbox
|
||||||
make_jumpbox();
|
make_jumpbox();
|
||||||
|
|
||||||
|
|
|
@ -671,6 +671,11 @@ for ($i = 0; $i < $total_posts; $i++) {
|
||||||
|
|
||||||
$is_first_post = ($post_id == $t_data['topic_first_post_id']);
|
$is_first_post = ($post_id == $t_data['topic_first_post_id']);
|
||||||
|
|
||||||
|
// Set meta description
|
||||||
|
if ($is_first_post || $i == 0) {
|
||||||
|
$page_cfg['meta_description'] = str_short(str_replace("\n", ' ', strip_tags(br2nl($message))), 220);
|
||||||
|
}
|
||||||
|
|
||||||
$template->assign_block_vars('postrow', [
|
$template->assign_block_vars('postrow', [
|
||||||
'ROW_CLASS' => !($i % 2) ? 'row1' : 'row2',
|
'ROW_CLASS' => !($i % 2) ? 'row1' : 'row2',
|
||||||
'POST_ID' => $post_id,
|
'POST_ID' => $post_id,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue