Add Corresponding Page META and OGP to overall_header.html

Need some custom code changes to the phpBB core simple enough that you feel doesn't require an extension? Then post your request here so that community members can provide some assistance.

NOTE: NO OFFICIAL SUPPORT IS PROVIDED IN THIS SUB-FORUM
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

NOTE: NO OFFICIAL SUPPORT IS PROVIDED IN THIS SUB-FORUM
User avatar
MiBBS
Registered User
Posts: 13
Joined: Mon Nov 27, 2023 6:38 pm
Location: Michigan, USA

Add Corresponding Page META and OGP to overall_header.html

Post by MiBBS »

Hello phpBB support forum.

I am inquiring about adding META tags into the overall_header.html template. I am using the default prosilver that is modified into my own style template name so that I can work with slight customizations I wish to have.

I have spent quite a bit of time working with my custom style based off default prosilver phpBB v3.3.11 on my php7.4 server.

Now that I am settled, pretty much, with the slight style modifications I have made, I would like to tackle the issue of expanding the usage of available META tags.

I am really curious of what code functions are what in regards to pulling information from the db and placing them into the meta tags where appropriate whether it is on the main index.php or a forum or a topic, or even a post if possible.

I recently came across this line to use for a meta description tag which sparked my intrigue:

Code: Select all

<!--OVERALL_HEADER.html-->

<meta name="description" content="<!-- IF S_INDEX -->{SITE_DESCRIPTION}<!-- ENDIF --><!-- IF S_VIEWFORUM -->{FORUM_DESC}<!-- ENDIF --><!-- IF S_VIEWTOPIC -->{PAGE_TITLE} &#124; {FORUM_DESC}<!-- IF PREVIOUS_PAGE --> &#124; Page {ON_PAGE}<!-- ENDIF --><!-- ENDIF -->" />
I see that there are some includes that call information from the db, like:
{SITE_DESCRIPTION}
{FORUM_DESC}
{PAGE_TITLE}

What other includes are available that can be used to add into meta tags? I would like to include all that are necessary to describe the page being viewed and which have the possibility of being indexed by various search engines or being shared by users to various social platforms. From the index to the category topic to the forum page to a topic and to an individual actual post along with any images that are related to their contents.

How can I insert og:image from unique topics or posts, if one is available?

This is my slightly customized <Head> data:

Code: Select all

<!--OVERALL_HEADER.html-->

<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1" />
{META}
<title><!-- IF UNREAD_NOTIFICATIONS_COUNT -->({UNREAD_NOTIFICATIONS_COUNT}) <!-- ENDIF --><!-- IF not S_VIEWTOPIC and not S_VIEWFORUM -->{SITENAME} - <!-- ENDIF --><!-- IF S_IN_MCP -->{L_MCP} - <!-- ELSEIF S_IN_UCP -->{L_UCP} - <!-- ENDIF -->{PAGE_TITLE}<!-- IF S_VIEWTOPIC or S_VIEWFORUM --> - {SITENAME}<!-- ENDIF --></title>
<meta name="title" content="<!-- IF UNREAD_NOTIFICATIONS_COUNT -->({UNREAD_NOTIFICATIONS_COUNT}) <!-- ENDIF --><!-- IF not S_VIEWTOPIC and not S_VIEWFORUM -->{SITENAME} - <!-- ENDIF --><!-- IF S_IN_MCP -->{L_MCP} - <!-- ELSEIF S_IN_UCP -->{L_UCP} - <!-- ENDIF -->{PAGE_TITLE}<!-- IF S_VIEWTOPIC or S_VIEWFORUM --> - {SITENAME}<!-- ENDIF -->">
<meta name="description" content="<!-- IF S_INDEX -->{SITE_DESCRIPTION}<!-- ENDIF --><!-- IF S_VIEWFORUM -->{FORUM_DESC}<!-- ENDIF --><!-- IF S_VIEWTOPIC -->{PAGE_TITLE} - {FORUM_DESC}<!-- IF PREVIOUS_PAGE --> - Page {ON_PAGE}<!-- ENDIF --><!-- ENDIF -->" />

<!-- IF S_ENABLE_FEEDS -->
<!-- IF S_ENABLE_FEEDS_OVERALL --><link rel="alternate" type="application/atom+xml" title="{L_FEED} - {SITENAME}" href="{{ path('phpbb_feed_index') }}"><!-- ENDIF -->
<!-- IF S_ENABLE_FEEDS_NEWS --><link rel="alternate" type="application/atom+xml" title="{L_FEED} - {L_FEED_NEWS}" href="{{ path('phpbb_feed_news') }}"><!-- ENDIF -->
<!-- IF S_ENABLE_FEEDS_FORUMS --><link rel="alternate" type="application/atom+xml" title="{L_FEED} - {L_ALL_FORUMS}" href="{{ path('phpbb_feed_forums') }}"><!-- ENDIF -->
<!-- IF S_ENABLE_FEEDS_TOPICS --><link rel="alternate" type="application/atom+xml" title="{L_FEED} - {L_FEED_TOPICS_NEW}" href="{{ path('phpbb_feed_topics') }}"><!-- ENDIF -->
<!-- IF S_ENABLE_FEEDS_TOPICS_ACTIVE --><link rel="alternate" type="application/atom+xml" title="{L_FEED} - {L_FEED_TOPICS_ACTIVE}" href="{{ path('phpbb_feed_topics_active') }}"><!-- ENDIF -->
<!-- IF S_ENABLE_FEEDS_FORUM and S_FORUM_ID --><link rel="alternate" type="application/atom+xml" title="{L_FEED} - {L_FORUM} - {FORUM_NAME}" href="{{ path('phpbb_feed_forum', { forum_id : S_FORUM_ID } ) }}"><!-- ENDIF -->
<!-- IF S_ENABLE_FEEDS_TOPIC and S_TOPIC_ID --><link rel="alternate" type="application/atom+xml" title="{L_FEED} - {L_TOPIC} - {TOPIC_TITLE}" href="{{ path('phpbb_feed_topic', { topic_id : S_TOPIC_ID } ) }}"><!-- ENDIF -->
<!-- EVENT overall_header_feeds -->
<!-- ENDIF -->

<meta property="og:type" content="website">
<meta property="og:locale" content="{S_USER_LANG}">
<meta property="og:site_name" content="{SITENAME}">
<meta property="og:url" content="{U_CANONICAL}">
<meta property="og:title" content="{PAGE_TITLE}">
<meta property="og:description" content="<!-- IF S_INDEX -->{SITE_DESCRIPTION}<!-- ENDIF --><!-- IF S_VIEWFORUM -->{FORUM_DESC}<!-- ENDIF --><!-- IF S_VIEWTOPIC -->{PAGE_TITLE} - {FORUM_DESC}<!-- IF PREVIOUS_PAGE --> - Page {ON_PAGE}<!-- ENDIF --><!-- ENDIF -->">
<meta property="og:image" content="">

<!-- IF U_CANONICAL --><link rel="canonical" href="{U_CANONICAL}"><!-- ENDIF -->

<!-- IF S_ALLOW_CDN -->
<script>
	WebFontConfig = {
		google: {
			families: ['Open+Sans:300,300i,400,400i,600,600i,700,700i,800,800i&subset=cyrillic,cyrillic-ext,greek,greek-ext,latin-ext,vietnamese']
		}
	};

	(function(d) {
		var wf = d.createElement('script'), s = d.scripts[0];
		wf.src = 'https://cdn.jsdelivr.net/npm/[email protected]/webfontloader.min.js';
		wf.async = true;
		s.parentNode.insertBefore(wf, s);
	})(document);
</script>
<!-- ENDIF -->
<link rel="stylesheet" href="{T_FONT_AWESOME_LINK}">
<link rel="stylesheet" href="{T_STYLESHEET_LINK}">
<link rel="stylesheet" href="{T_STYLESHEET_LANG_LINK}">
<!-- IF S_CONTENT_DIRECTION eq 'rtl' --><link rel="stylesheet" href="{T_THEME_PATH}/bidi.css?assets_version={T_ASSETS_VERSION}"><!-- ENDIF -->
<!-- IF S_PLUPLOAD --><link rel="stylesheet" href="{T_THEME_PATH}/plupload.css?assets_version={T_ASSETS_VERSION}"><!-- ENDIF -->
<!-- IF S_COOKIE_NOTICE --><link rel="stylesheet" href="{T_ASSETS_PATH}/cookieconsent/cookieconsent.min.css?assets_version={T_ASSETS_VERSION}">
<!-- ENDIF -->
<!--[if lte IE 9]>
<link rel="stylesheet" href="{T_THEME_PATH}/tweaks.css?assets_version={T_ASSETS_VERSION}">
<![endif]-->
<!-- EVENT overall_header_head_append -->{$STYLESHEETS}<!-- EVENT overall_header_stylesheets_after -->

<!-- phpBB style name: MiBBS
Based on default style: prosilver
Original author:  Tom Beddard (http://www.subBlue.com/)
Modified by: MiBBS -->
</head>
? Not sure what this one does: {META}

I have also tested out a few extensions that I could locate in regards to this subject for the purpose of when a post or a page is shared that it will display the correct title and description via Open Graph Protocols; sharing into Facebook or Twitter, or most any other site that needs OG data to post accurate information. These are the extensions that I have experimented with and are currently disabled:
Magic OGP parser
Description: Enables OGP detection for pasted URLS in posts
Version: 1.0.3
Release Time: 2017-11-15
Licence: GPL-2.0
Requirements phpBB Version: >=3.2
PHP Version: >=5.4
Metainformation and Favicon
Description: With this extension it is possible to make your forum SEO friendly. In the admin panel it offers some functions for controlling meta information and favicons.
Version: 1.0.5
Release Time: 2021-11-11
Licence: GPL-2.0-only
Requirements phpBB Version: >= 3.2.10,<3.4.0@dev
PHP Version: >=7.0.0,<9.0.0
SEO Metadata
Description: SEO Metadata extension for phpBB
Version: 1.4.1
Release Time: 2021-04-07
Licence: GPL-2.0-only
Requirements phpBB Version: ~3.3.0
PHP Version: ^7.1.3 || ^8.0.0
The above extensions did not seem to work for me. The SEO Metadata did not display og:image in source page or allow supplying image dimensions inside its extension manager area. The Metainformation and Favicon extension was nice, but it doesn't supply meta data for each unique forum, category, topic, or post. Plus, the favicon area is something that is not really needed since favicons are supplied already in root domain files. The Magic OGP Parser did not seem to show me any results in parsing an image from topics or posts data even after scraping the data via fb developer tool.

Another question that I am curious of asking about this truly great forum software is, why does not the default phpbb prosilver style come with at least some of the most basic meta and meta property og tags? Surely would be a great addition to allow the ability of share phpbb forums and posts.

Thank you for your time and support in regards to my questions about adding a complete spectrum of meta's. The less extensions needed the better to help avoid any version conflicts etc. I truly appreciate your help with this.
User avatar
MiBBS
Registered User
Posts: 13
Joined: Mon Nov 27, 2023 6:38 pm
Location: Michigan, USA

Re: Add Corresponding Page META and OGP to overall_header.html

Post by MiBBS »

So nobody seems to understand what I am talking about.

It cannot be that difficult.

What phpbb 'include variables' [TEXT DATA] can you put into meta or meta property OG tags that correspond to each individual types of pages phpbb has?

you have viewforum.php
you have viewtopic.php

In the overall_header.html:

Code: Select all

<META NAME="DESCRIPTION" CONTENT="<!-- IF S_INDEX -->{SITE_DESCRIPTION}<!-- ENDIF --><!-- IF S_VIEWFORUM -->{FORUM_DESC}<!-- ENDIF --><!-- IF S_VIEWTOPIC -->{PAGE_TITLE} - {FORUM_DESC}<!-- IF PREVIOUS_PAGE --> - Page {ON_PAGE}<!-- ENDIF --><!-- ENDIF -->" />
Like well, here are a few:
{SITE_DESCRIPTION}
{FORUM_DESC}
{PAGE_TITLE}

.. I am willing to bet that there are more for things like {CATEGORY_TITLE} , {CATEGORY_DESCRIPTION} , {FORUM_TOPIC} , {POST_TITLE} , {POST_DESCRIPTION} (Which would be the first, say 160 characters, if that many out of the firs post of a topic) .. etc .. etc .. etc ..

Goodness, the phpbb coders gotta know what I am talking about.

Standard page metas:

Code: Select all

<meta name="title" content=" PHPBB DB INCLUDE VARIABLES HERE ">
<meta name="description" content=" PHPBB DB INCLUDE VARIABLES HERE ">
Standard meta property OG tags:

Code: Select all

<meta property="og:type" content="website">
<meta property="og:locale" content="{S_USER_LANG}">
<meta property="og:site_name" content="{SITENAME}">
<meta property="og:url" content="{U_CANONICAL}">
<meta property="og:title" content="{PAGE_TITLE}">
<meta property="og:description" content="<!-- IF S_INDEX -->{SITE_DESCRIPTION}<!-- ENDIF --><!-- IF S_VIEWFORUM -->{FORUM_DESC}<!-- ENDIF --><!-- IF S_VIEWTOPIC -->{PAGE_TITLE} - {FORUM_DESC}<!-- IF PREVIOUS_PAGE --> - Page {ON_PAGE}<!-- ENDIF --><!-- ENDIF -->">
<meta property="og:image" content="">
So ya'll telling me you don't understand what I am talking about, yet?

What are the POSSIBLE phpbb include variables that you can include into META TAGS? [text]

For example, phpbb uses a type of php code to use if elseif. Insert the forum variables similar to this into the overall_header.html to CORRELATE EACH INDIVIDUAL PAGE'S DATA for the purpose of adding it into the META TAGS:

Code: Select all

<!-- IF S_INDEX -->{SITE_DESCRIPTION}<!-- ENDIF --><!-- IF S_VIEWFORUM -->{FORUM_DESC}<!-- ENDIF --><!-- IF S_VIEWTOPIC -->{PAGE_TITLE} - {FORUM_DESC}<!-- IF PREVIOUS_PAGE --> - Page {ON_PAGE}<!-- ENDIF --><!-- ENDIF -->
Last edited by MiBBS on Wed Nov 29, 2023 12:15 pm, edited 1 time in total.
User avatar
Mannix_
Registered User
Posts: 1932
Joined: Sun Oct 25, 2015 2:56 pm
Name: Matt

Re: Add Corresponding Page META and OGP to overall_header.html

Post by Mannix_ »

In the past there was w phpbb wiki where you could check the available template variables but that is no longer the case so if anyone could post a link where people can find them that would be nice

old link for example https://wiki.phpbb.com/Viewtopic_Template_Variables
Did I helped You? Consider a donation.
New version of phpBB has been released? My styles aren't validated for it yet? Check my page for the latest downloads!
User avatar
MiBBS
Registered User
Posts: 13
Joined: Mon Nov 27, 2023 6:38 pm
Location: Michigan, USA

Re: Add Corresponding Page META and OGP to overall_header.html

Post by MiBBS »

Mannix_ wrote: Wed Nov 29, 2023 12:15 pm In the past there was w phpbb wiki where you could check the available template variables but that is no longer the case so if anyone could post a link where people can find them that would be nice

old link for example https://wiki.phpbb.com/Viewtopic_Template_Variables
Thank you! YES ... BUT we do not need ALL of the variables .. ONLY THE ONES of TEXT that can be put into the overall_header.html META TAGS to describe each page phpbb puts out. So Search Engines can see what each page or post is about.

Simply put the data into the metas and meta property OG tags. And presto! The only thing that is missing is the meta property og:image tag being pulled out of each post or page phpbb puts out. So an image can go along with shared posts to social media platforms or whatever need be.
Last edited by MiBBS on Wed Nov 29, 2023 12:36 pm, edited 1 time in total.
User avatar
MiBBS
Registered User
Posts: 13
Joined: Mon Nov 27, 2023 6:38 pm
Location: Michigan, USA

Re: Add Corresponding Page META and OGP to overall_header.html

Post by MiBBS »

There is no need to utilize an extension for meta tags when it can be hard coded into the overall_header.html using the standard phpbb variables that are already being stored in phpbb's db. {variable_here} else if this page {corresponding_variable_here} end if and so on.

There must be a variable to pull images as well .. to put into the og:image area in the same way.

So, what are all the variables that can be pulled and put into META tags?

It's a simple solution that all phpbb styles can implement into the overall_header.html file without needing an extension ... We just need the variables that can be used for .. meta data.

Further, I would really like to know why the php developer team does not implement basic meta tags other than just using them in the ...

Code: Select all

<title><!-- IF UNREAD_NOTIFICATIONS_COUNT -->({UNREAD_NOTIFICATIONS_COUNT}) <!-- ENDIF --><!-- IF not S_VIEWTOPIC and not S_VIEWFORUM -->{SITENAME} - <!-- ENDIF --><!-- IF S_IN_MCP -->{L_MCP} - <!-- ELSEIF S_IN_UCP -->{L_UCP} - <!-- ENDIF -->{PAGE_TITLE}<!-- IF S_VIEWTOPIC or S_VIEWFORUM --> - {SITENAME}<!-- ENDIF --></title>
meta description is nice to have ..

And well, with that data, you can also easily fill in the meta property OG tags also. phpbb already has the needed variables. But they are not being used to add these meta datas.
User avatar
MiBBS
Registered User
Posts: 13
Joined: Mon Nov 27, 2023 6:38 pm
Location: Michigan, USA

Re: Add Corresponding Page META and OGP to overall_header.html

Post by MiBBS »

Found this in the includes/functions.php .. not sure if it is all there in the one file though. But some of it is useful that can be coded into the metas ..

The stand alone {META} variable apparently adds this single meta line. Nice to know what it does:

Code: Select all

<meta http-equiv="refresh" content="' . $time . '; url=' . $url . '" />

Code: Select all

/* ----------- {META} from around line 1860 ----------- */

/**
* Meta refresh assignment
* Adds META template variable with meta http tag.
*
* @param int $time Time in seconds for meta refresh tag
* @param string $url URL to redirect to. The url will go through redirect() first before the template variable is assigned
* @param bool $disable_cd_check If true, meta_refresh() will redirect to an external domain. If false, the redirect point to the boards url if it does not match the current domain. Default is false.
*/
function meta_refresh($time, $url, $disable_cd_check = false)
{
	global $template, $refresh_data, $request;

	$url = redirect($url, true, $disable_cd_check);
	if ($request->is_ajax())
	{
		$refresh_data = array(
			'time'	=> $time,
			'url'	=> $url,
		);
	}
	else
	{
		// For XHTML compatibility we change back & to &amp;
		$url = str_replace('&', '&amp;', $url);

		$template->assign_vars(array(
			'META' => '<meta http-equiv="refresh" content="' . $time . '; url=' . $url . '" />')
		);
	}

	return $url;
}

/* ----------- to around line 1900 ----------- */


I plucked out some of these variables that could be used for adding into metas, but there aren't many. Does anyone else know of any more or exactly what each of these are defining as far as the pages forum title/category title/page title/topic/descriptions/opening post text ??

Code: Select all

/* ----------- from around line 3900 in includes/functions.php ----------- */

	// The following assigns all _common_ variables that may be used at any point in a template.
	$template->assign_vars(array(
		'SITENAME'						=> $config['sitename'],
		'SITE_DESCRIPTION'				=> $config['site_desc'],
		'PAGE_TITLE'					=> $page_title,
		'SCRIPT_NAME'					=> str_replace('.' . $phpEx, '', $user->page['page_name']),
		
		'L_INDEX'			=> ($config['board_index_text'] !== '') ? $config['board_index_text'] : $user->lang['FORUM_INDEX'],
		'L_SITE_HOME'		=> ($config['site_home_text'] !== '') ? $config['site_home_text'] : $user->lang['HOME'],
		
		'S_FORUM_ID'			=> $forum_id,
		'S_TOPIC_ID'			=> $topic_id,
		
	/**
	* Execute code and/or overwrite _common_ template variables after they have been assigned.
	*
	* @event core.page_header_after
	* @var	string	page_title			Page title
	* @var	bool	display_online_list		Do we display online users list
	* @var	string	item				Restrict online users to a certain
	*									session item, e.g. forum for
	*									session_forum_id
	* @var	int		item_id				Restrict online users to item id
	* @var	array		http_headers			HTTP headers that should be set by phpbb
	*
	* @since 3.1.0-b3
	*/
	$vars = array('page_title', 'display_online_list', 'item_id', 'item', 'http_headers');
	extract($phpbb_dispatcher->trigger_event('core.page_header_after', compact($vars)));
	
/* -----------  to around line 4150   ----------- */
Still not sure of what all of those do, precisely. Some have to get actual page data for where on the forum you are.

And then, you have other pages, like the terms and registration pages .. contact page, faq .. all sorts of pages that I am not sure of what they all display in the page meta title by default if they display any data at all for SE's. So that would have to be figured out to not include some of this data on some of the pages, somehow.
User avatar
MiBBS
Registered User
Posts: 13
Joined: Mon Nov 27, 2023 6:38 pm
Location: Michigan, USA

Re: Add Corresponding Page META and OGP to overall_header.html

Post by MiBBS »

Couple interesting reference posts I found .. some are old not sure about, but still ..

viewtopic.php?t=1193755

Probably all outdated but .. just sharing viewtopic.php?p=13217432#p13217432
User avatar
P_I
Community Team Member
Community Team Member
Posts: 2397
Joined: Tue Mar 01, 2011 8:35 pm
Location: Western Canada 🇨🇦

Re: Add Corresponding Page META and OGP to overall_header.html

Post by P_I »

Since you are new here on phpBB.com please keep in mind that we have a six hour bumping rule. All team members and community members here are volunteers, so we ask you to wait at least six hours before bumping your topic or, if no-one has replied to your last post, edit your last post. Thanks!
Normal people… believe that if it ain’t broke, don’t fix it. Engineers believe that if it ain’t broke, it doesn’t have enough features yet. – Scott Adams
User avatar
MiBBS
Registered User
Posts: 13
Joined: Mon Nov 27, 2023 6:38 pm
Location: Michigan, USA

Re: Add Corresponding Page META and OGP to overall_header.html

Post by MiBBS »

I am new to this, so, I have to rough draft, or sort some meta variable data for just the title tag - for now . This is all mostly default title data that I want to modify still. Then get to the meta description data and then finally to the OG datas. The og:image is where I hope to get some help with figuring out how to pull an image out of the post IF there is one. IF NOT THEN use default image supplied in images folder.

The way I see it, this needs to be done for those that put in tons of hard work into creating their phpbb boards so they can provide accurate data to be nicely listed in se's as well as for the users that share the posts to others that would appreciate the data.

Which of course would not be possible if it were not for the gracious phpbb developers that help provide this great software.

Us simple users just need some help getting some decent meta data in there. Without decent metas, what is the point of putting all the work in creating our boards only to have them lack in proper and nicely listed SE results? A title tag just isn't enough with all the information that can be indexed by search engines and shared to other media platforms. Meta tags should be a key priority before bothering to develop or create a board. Unless you do not care about actually having your board used as you would like it to to be with getting traffic by being properly indexed by global search engines.

---
IMO, phpbb developers should place implementation of meta and og tags as a top priority. The more phpbb users board's get shared and indexed and collect traffic from search engines, the more recognition phpbb will gain. But, whatever..
---


Anyway, I seemingly have to try and figure this out for myself. I am just sharing notes here in the hopes that someone might chime in; it would be great if anyone with some super knowledge could help out. But please do not try to share an extension as a fix for this. This should be built right in to the overall_header.html template calling the needed data for all needed metas throughout all the parsed forum pages and be a done deal.

Code: Select all

<!-- DEFAULT TITLE -->

<title><!-- IF UNREAD_NOTIFICATIONS_COUNT -->({UNREAD_NOTIFICATIONS_COUNT}) <!-- ENDIF -->
<!-- IF not S_VIEWTOPIC and not S_VIEWFORUM -->{SITENAME} - <!-- ENDIF -->
<!-- IF S_IN_MCP -->{L_MCP} - <!-- ELSEIF S_IN_UCP -->{L_UCP} - <!-- ENDIF -->
{PAGE_TITLE}
<!-- IF S_VIEWTOPIC or S_VIEWFORUM --> - {SITENAME}<!-- ENDIF --></title>

Code: Select all

<!-- NOTES and VARIABLES -->

index:
<title>SITE_NAME - Forums</title>
<title>{SITENAME} - {PAGE_TITLE}</title>

ucp: ucp.php
<title>SITE_NAME - User Control Panel - Front page</title>
<title>{SITENAME} - User Control Panel - Front page</title>

mcp: mcp.php
<title>SITE_NAME - Moderator Control Panel - Main</title>
<title>{SITENAME} - Moderator Control Panel - Main</title>

category index: viewforum.php
<title>Social Chat - SITE_NAME</title>
<title>{PAGE_TITLE} - {SITENAME}</title>

forum index: viewforum.php
<title>Public Social Topics - SITE_NAME</title>
<title>{FORUM_NAME}or{U_FORUM}? - {SITENAME}</title>

topic: viewtopic.php
<title>A_TOPIC_TITLE - SITE_NAME</title>
<title>{TOPIC_TITLE}or{U_TOPIC}? - {SITENAME}</title>

faq: app.php/help/faq
<title>SITE_NAME - Frequently Asked Questions</title>
<title>{SITENAME} - Frequently Asked Questions</title>

contact: memberlist.php?mode=contactadmin
<title>SITE_NAME - Send email</title>
<title>{SITENAME} - Send email</title>

privacy: ucp.php?mode=privacy
<title>SITE_NAME - User Control Panel - Privacy policy</title>
<title>{SITENAME} - User Control Panel - Privacy policy</title>

terms: ucp.php?mode=terms
<title>SITE_NAME - User Control Panel - Terms of use</title>
<title>{SITENAME} - User Control Panel - Terms of use</title>

register: ucp.php?mode=register
<title>SITE_NAME - User Control Panel - Register</title>
<title>{SITENAME} - User Control Panel - Register</title> {L_REGISTRATION}

login: ucp.php?mode=login&redirect=index.php
<title>SITE_NAME - User Control Panel - Sign in</title>
<title>{SITENAME} - User Control Panel - Sign in</title>

Code: Select all

<!-- ROBOTS can be useful in some parsed phpbb pages - not all pages should allow robots to index or follow -->

<meta name="robots" content="index, follow">

{IF meta robots ON then ...
ELSEIF meta robots OFF then ... NONE END IF etc.}
<meta name="robots" content="index, nofollow"> (register)
<meta name="robots" content="index, follow"> (index,viewforum,viewtopic,faq,privacy,terms)
<meta name="robots" content="noindex, nofollow"> (login,ucp,mcp,contact)
<meta name="robots" content="noindex, follow"> 
That's all I got for now - to be edited further as time allows for this.
User avatar
MiBBS
Registered User
Posts: 13
Joined: Mon Nov 27, 2023 6:38 pm
Location: Michigan, USA

Re: Add Corresponding Page META and OGP to overall_header.html

Post by MiBBS »

So just to add to my notes here; this is what I have came up with so far which still requires further development, but is useable:
(overall_header.html)

TITLE
-------
Default:

Code: Select all

<title><!-- IF UNREAD_NOTIFICATIONS_COUNT -->({UNREAD_NOTIFICATIONS_COUNT}) <!-- ENDIF --><!-- IF not S_VIEWTOPIC and not S_VIEWFORUM -->{SITENAME} - <!-- ENDIF --><!-- IF S_IN_MCP -->{L_MCP} - <!-- ELSEIF S_IN_UCP -->{L_UCP} - <!-- ENDIF -->{PAGE_TITLE}<!-- IF S_VIEWTOPIC or S_VIEWFORUM --> - {SITENAME}<!-- ENDIF --></title>
Modified:

Code: Select all

<title><!-- IF UNREAD_NOTIFICATIONS_COUNT -->({UNREAD_NOTIFICATIONS_COUNT}) <!-- ENDIF --><!-- IF S_INDEX -->{SITENAME} - {PAGE_TITLE}<!-- ENDIF --><!-- IF S_VIEWFORUM -->{FORUM_NAME} - {SITENAME}<!-- ELSEIF S_VIEWTOPIC -->{TOPIC_TITLE} - {SITENAME}<!-- ENDIF --><!-- IF not S_INDEX and not S_VIEWFORUM and not S_VIEWTOPIC -->{PAGE_TITLE} - {SITENAME}<!-- ENDIF --></title>
META TITLE
--------------
Default: NONE
Modified:

Code: Select all

<meta name="title" content="<!-- IF S_INDEX -->{SITENAME}<!-- ENDIF --><!-- IF S_VIEWFORUM -->{FORUM_NAME} - {SITENAME}<!-- ELSEIF S_VIEWTOPIC -->{TOPIC_TITLE} - {SITENAME}<!-- ENDIF --><!-- IF not S_INDEX and not S_VIEWFORUM and not S_VIEWTOPIC -->{PAGE_TITLE} - {SITENAME}<!-- ENDIF -->">
META DESCRIPTION
-----------------------
Default:

Code: Select all

<meta name="description" content="{SITE_DESCRIPTION}">
Modified:

Code: Select all

<meta name="description" content="<!-- IF S_INDEX -->{SITE_DESCRIPTION}<!-- ENDIF --><!-- IF S_VIEWFORUM -->{FORUM_DESC}<!-- ENDIF --><!-- IF S_VIEWTOPIC -->A forum topic all about {TOPIC_TITLE} - Sign in and join the discussion at {SITENAME}!<!-- ENDIF -->">
KEYWORDS
-------------
Default: NONE
Modified:

Code: Select all

<meta name="keywords" content="add a phrase, or, others, keywords of choice<!-- IF S_VIEWFORUM -->, {FORUM_NAME}, topics<!-- ELSEIF S_VIEWTOPIC -->, {TOPIC_TITLE}, comments<!-- ENDIF -->">
OPEN GRAPH PROTOCOL
-----------------------------
Default: NONE
Modified:

Code: Select all

<meta property="og:type" content="website">
<meta property="og:locale" content="{S_USER_LANG}">
<meta property="og:site_name" content="{SITENAME}">
<meta property="og:url" content="{U_CANONICAL}">
<meta property="og:title" content="<!-- IF S_INDEX -->{SITENAME} - {PAGE_TITLE}<!-- ENDIF --><!-- IF S_VIEWFORUM -->{FORUM_NAME}<!-- ELSEIF S_VIEWTOPIC -->{TOPIC_TITLE}<!-- ENDIF --><!-- IF not S_INDEX and not S_VIEWFORUM and not S_VIEWTOPIC -->{PAGE_TITLE}<!-- ENDIF -->">
<meta property="og:description" content="<!-- IF S_INDEX -->{SITE_DESCRIPTION}<!-- ENDIF --><!-- IF S_VIEWFORUM -->{FORUM_DESC}<!-- ENDIF --><!-- IF S_VIEWTOPIC -->Forum topic about {TOPIC_TITLE} - Sign in and join the discussion.<!-- ENDIF -->">
<meta property="og:image" content="">
I'm still hunting for other page title and description variables that can be used for other things and pages. The ones above work fine for index, forum pages, and topic pages. Please feel free to chime in with any useful information that can be used for all types of meta's. Thank you.

Return to “phpBB Custom Coding”