News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

meta description and title the same

Started by bjraines, May 21, 2007, 10:30:03 AM

Previous topic - Next topic

bjraines

I am basically using a css modified default template.

my meta description and page title are always the same.

is this correct?

metallica48423

both feed off of $context['page_title'], so yes, this is correct.  However you are able to add other static elements such as modifying your meta tags by removing ' , $context['page_title'], '

This is done to give you dynamic description tags, based on the page title.

Code (index.template.php) Select

<meta name="description" content="', $context['page_title'], '" />
<title>', $context['page_title'], '</title>
Justin O'Leary
Ex-Project Manager
Ex-Lead Support Specialist

QuoteMicrosoft wants us to "Imagine life without walls"...
I say, "If there are no walls, who needs Windows?"


Useful Links:
Online Manual!
How to Help us Help you
Search
Settings Repair Tool

bjraines

Quote from: BlackMage on May 21, 2007, 10:34:48 AM
both feed off of $context['page_title'], so yes, this is correct.  However you are able to add other static elements such as modifying your meta tags by removing ' , $context['page_title'], '

This is done to give you dynamic description tags, based on the page title.

Code (index.template.php) Select

<meta name="description" content="', $context['page_title'], '" />
<title>', $context['page_title'], '</title>



I see , what if i wanted it to be page title and forum name

i have been trying to get it that way but keep getting a template error

metallica48423

im not entirely sure, so i'll have to leave this up to someone else :(

If i find anything, however, i shall let you know :)
Justin O'Leary
Ex-Project Manager
Ex-Lead Support Specialist

QuoteMicrosoft wants us to "Imagine life without walls"...
I say, "If there are no walls, who needs Windows?"


Useful Links:
Online Manual!
How to Help us Help you
Search
Settings Repair Tool

bjraines

Black mage, ffxi fan?

i figured it out...i forgot the . between varialbles

what i need to figure out now is how to construct the statement

if on index page do this but all other pages do this

metallica48423

try this:

if ($context['current_action'] == home || empty($context['current_action'])) {
code to do if on the home page
}

else
{
code to do if not on the home page
}


Not sure about it, but its worth a try?
Justin O'Leary
Ex-Project Manager
Ex-Lead Support Specialist

QuoteMicrosoft wants us to "Imagine life without walls"...
I say, "If there are no walls, who needs Windows?"


Useful Links:
Online Manual!
How to Help us Help you
Search
Settings Repair Tool

Oldiesmann

if(empty($context['current_action']) || $context['current_action'] == 'boardindex'))
{
// Do something here
}
else
{
// Do something else here
}
Michael Eshom
Christian Metal Fans

metallica48423

ah, so its boardindex.  Oops :P

Thanks Oldiesmann
Justin O'Leary
Ex-Project Manager
Ex-Lead Support Specialist

QuoteMicrosoft wants us to "Imagine life without walls"...
I say, "If there are no walls, who needs Windows?"


Useful Links:
Online Manual!
How to Help us Help you
Search
Settings Repair Tool

bjraines

kudos guys that awesome. hopefully one day ill be at the point to help out

bjraines

Quote from: Oldiesmann on May 21, 2007, 07:23:43 PM
if(empty($context['current_action']) || $context['current_action'] == 'boardindex'))
{
// Do something here
}
else
{
// Do something else here
}



would you mind explaining the first statement , the (empty($context['current_action'

bjraines

I am using the code in this way

if(empty($context['current_action']) || $context['current_action'] == 'boardindex')
{
echo ' <title>', $context['page_title'],'&nbsp;at&nbsp;',$context['forum_name'],'</title>';
}
else
{
echo ' <title>Where does this show up </title>';
}



although I see how it works, it doesn't do what i need it to

I want the index page only in the if statement and then the else statement apply to all the other boards and threads.

SleePy

empty($context['current_action']) should keep undefined index errors from occurring as it ensures that it is set (or in this case does it if it isn't otherwise it is and tries the next part)..

Try this:
if(empty($_REQUEST['action']))
{
echo ' <title>', $context['page_title'],'&nbsp;at&nbsp;',$context['forum_name'],'</title>';
}
else
{
echo ' <title>Where does this show up </title>';
}
Jeremy D ~ Site Team / SMF Developer ~ GitHub Profile ~ Join us on IRC @ Libera.chat/#smf ~ Support the SMF Support team!

Advertisement: