Page 2 of 2

Re: Meta Description?

Posted: Mon May 06, 2019 7:03 pm
by SMP1977
Mick wrote:
Sat Jul 22, 2017 6:34 pm
No, you have to create them yourself with 3.2. If you look at an older version of prosilver overall_header.html say 3.0.11 you'll see:

Code: Select all

<meta name="keywords" content="" />
<meta name="description" content="" />
I think the description can be relevant but the keywords not so much. There is a lot of information available on the net about keywords and description.

I'm saying all this and there may be an extension for it?
So if i am reading and understanding this correctly, i can copy this code featured in this quoted text above, paste it into my overall_header, and add the info i want to add inbetween the red quotation marks?

Where in the .html file do i paste this code?

it is worth nothing that i am on Ver. 3.2.5

Re: Meta Description?

Posted: Mon May 06, 2019 7:08 pm
by thecoalman
Correct, you would put it between the <head> tags. However this is going to put the same description on every page. Descriptions should be unique or none at all. This will work better because it's dynamic.

Code: Select all

<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 -->" />
The keywords are largely irrelevant but should also be unique and that is not easy to accomplish.

Re: Meta Description?

Posted: Fri Sep 13, 2019 2:52 pm
by vivday
cally6008 wrote:
Sun Jul 30, 2017 12:11 pm
I use this code

<meta name="description" content="<!-- IF SCRIPT_NAME eq 'index' -->{SITE_DESCRIPTION}<!-- ENDIF --><!-- IF SCRIPT_NAME eq 'viewforum' -->{FORUM_DESC}<!-- ENDIF --><!-- IF SCRIPT_NAME eq 'viewtopic' -->{PAGE_TITLE} &#124; {FORUM_DESC}<!-- IF PREVIOUS_PAGE --> &#124; Page {ON_PAGE}<!-- ENDIF --><!-- ENDIF -->" />

placed just above the {META} tag in overall_header.html

I haven't checked it recently to see if it still works, I really should, oops
Hello,

Can you tell me what is the below code for?

Code: Select all

<!-- IF PREVIOUS_PAGE --> &#124; Page {ON_PAGE}<!-- ENDIF -->
Also can I add my own text to the code as below? I'd like to add the description as the topic name and some text after the topic name. Is the below way right to do it?

Code: Select all

<!-- IF SCRIPT_NAME eq 'viewtopic' -->{Topic} & "Travel", {TOPIC} & Hotels; <!-- ENDIF --> 
Thanks.

Re: Meta Description?

Posted: Fri Sep 13, 2019 3:49 pm
by Brf
vivday wrote:
Fri Sep 13, 2019 2:52 pm
Can you tell me what is the below code for?

Code: Select all

<!-- IF PREVIOUS_PAGE --> &#124; Page {ON_PAGE}<!-- ENDIF -->
It adds the page number to the page description:
tab-desc (2).jpg
tab-desc (2).jpg (31.41 KiB) Viewed 147 times
thecoalman wrote:
Mon May 06, 2019 7:08 pm
Also can I add my own text to the code as below?
I doubt you really want to add "Travel" and "Hotels" to the description for every single topic on your board. I am not sure what those Ampersands are going to do either, since an ampersand is a control character.

Re: Meta Description?

Posted: Fri Sep 13, 2019 4:13 pm
by vivday
Thank you very much! :)
Brf wrote:
Fri Sep 13, 2019 3:49 pm

I doubt you really want to add "Travel" and "Hotels" to the description for every single topic on your board. I am not sure what those Ampersands are going to do either, since an ampersand is a control character.
Actually, I do want to add "Travel" and "Hotels" to the description of every topic. I just want to know how is topic name defined in the phpBB code. Is it defined as {TOPIC_TITLE} or something else?

Thanks.

Re: Meta Description?

Posted: Fri Sep 13, 2019 4:18 pm
by vivday
Also I wanted to know what is the ampersand and the number (&#124) in the above code do?

Thanks :)

Re: Meta Description?

Posted: Fri Sep 13, 2019 4:22 pm
by Brf

Code: Select all

{TOPIC_TITLE}
&#124; is HTML code to display the character with ACSII code 124 which would be a |

Re: Meta Description?

Posted: Fri Sep 13, 2019 4:39 pm
by vivday
Brf wrote:
Fri Sep 13, 2019 4:22 pm

Code: Select all

{TOPIC_TITLE}
&#124; is HTML code to display the character with ACSII code 124 which would be a |
Thanks a lot, buddy. :)

Re: Meta Description?

Posted: Sat Sep 14, 2019 9:49 am
by thecoalman
vivday wrote:
Fri Sep 13, 2019 2:52 pm

Can you tell me what is the below code for?
As noted it adds page number, every page on your site should have unique title and this is the only way to do it.


Also can I add my own text to the code as below? I'd like to add the description as the topic name and some text after the topic name. Is the below way right to do it?

Code: Select all

<!-- IF SCRIPT_NAME eq 'viewtopic' -->{Topic} & "Travel", {TOPIC} & Hotels; <!-- ENDIF --> 
SE's are only goin to go so deep on descriptions, and you don't want to overdue it. This might be more appropriate. S_VIEWTOPIC is a switch that is et to true only in viewtopc. Similar switches are in index, viewforum etc.

Code: Select all

<!-- IF S_VIEWTOPIC -->{TOPIC_TITLE} &#124; {FORUM_NAME}<!-- ENDIF --> 
Also note that ampersands along with < > ' " are special characters in HTML and should always be represented by their entity in content, for & it is &nbsp;. The only time you would use a < is for tags. If you use them in content the browser may misinterpret as HTML markup.

https://www.w3schools.com/html/html_entities.asp


vivday wrote:
Fri Sep 13, 2019 4:13 pm
I just want to know how is topic name defined in the phpBB code. Is it defined as {TOPIC_TITLE} or something else?
You are going to find an array that assigns template variables in various scripts, in particular the main ones like viewtopic.php, around line 745:

Code: Select all

// Send vars to template
$template->assign_vars(array(
	'FORUM_ID' 		=> $forum_id,
	'FORUM_NAME' 	=> $topic_data['forum_name'],
	'FORUM_DESC'	=> generate_text_for_display($topic_data['forum_desc'], $topic_data['forum_desc_uid'], $topic_data['forum_desc_bitfield'], $topic_data['forum_desc_options']),
	'TOPIC_ID' 		=> $topic_id,
	'TOPIC_TITLE' 	=> $topic_data['topic_title'],
	'TOPIC_POSTER'	=> $topic_data['topic_poster'],
A little further down you'll find another one, this can only be used inside post content.

Code: Select all

	$post_row = array(
		'POST_AUTHOR_FULL'		=> ($poster_id != ANONYMOUS) ? $user_cache[$poster_id]['author_full'] : get_username_string('full', $poster_id, $row['username'], $row['user_colour'], $row['post_username']),
		'POST_AUTHOR_COLOUR'	=> ($poster_id != ANONYMOUS) ? $user_cache[$poster_id]['author_colour'] : get_username_string('colour', $poster_id, $row['username'], $row['user_colour'], $row['post_username']),
		'POST_AUTHOR'			=> ($poster_id != ANONYMOUS) ? $user_cache[$poster_id]['author_username'] : get_username_string('username', $poster_id, $row['username'], $row['user_colour'], $row['post_username']),
		'U_POST_AUTHOR'			=> ($poster_id != ANONYMOUS) ? $user_cache[$poster_id]['author_profile'] : get_username_string('profile', $poster_id, $row['username'], $row['user_colour'], $row['post_username']),
In includes/function.php there is another one that is used to assign all common template variables that can be used in almost any template. Around line 4500:

Code: Select all

	// 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']),

Re: Meta Description?

Posted: Sun Sep 15, 2019 12:45 pm
by vivday
thecoalman wrote:
Sat Sep 14, 2019 9:49 am

As noted it adds page number, every page on your site should have unique title and this is the only way to do it.


SE's are only goin to go so deep on descriptions, and you don't want to overdue it. This might be more appropriate. S_VIEWTOPIC is a switch that is et to true only in viewtopc. Similar switches are in index, viewforum etc.

Code: Select all

<!-- IF S_VIEWTOPIC -->{TOPIC_TITLE} &#124; {FORUM_NAME}<!-- ENDIF --> 
Thank you, buddy. :)
Does that mean the Meta desciption shouldn't be long?