This topic is locked
[SOLVED]

 Home page meta tags

4/27/2017 8:35:39 PM
PHPRunner General questions
H
headingwest author

Hi All,
How do I change the meta tags (eg <meta name="description" content="Here is a precise description of my awesome webpage.">) on my home page?
Feature request: can we add a "Meta Tag" section to the menu builder please Sergey? A single place to add all the meta tags.

romaldus 4/27/2017

add meta tag is easy in phprunner.

For example, i want to change the page title and add description, keyword, robots, subjects, copyright meta tag in my view page
Step 1 : In Visual editor, switch to HTML mode and add meta tags between <HEAD> </HEAD>

<HEAD>

<META http-equiv="X-UA-Compatible" content="IE=Edge">

<META name="viewport" content="width=device-width, initial-scale=1.0">

<TITLE>

{$custompagetitle}

</TITLE>

<META http-equiv="Content-Type" content="text/html; charset=utf-8">

<META name="description" content="{$metadesc}">

<META name="keywords" content="{$metakeywords}">

<META name="robots" content="{$metarobots}">

<META name="subject" content='="{$metasubject}"'>

<META name="copyright" content='="{$metacopyright}"'>

<LINK href="styles/default.css" rel="stylesheet" type="text/css">

{BEGIN rtlCSS}

<LINK href="styles/defaultRTL.css" rel="stylesheet" type="text/css">

{END rtlCSS}

{BEGIN styleCSSFiles}

<LINK href="{$stylepath}" rel="stylesheet" type="text/css">

{END styleCSSFiles}

<META name="GENERATOR" content="MSHTML 11.00.9600.18618">

</HEAD>


Step 2. Go to events, View page before display add the following code

$xt->assign('custompagetitle', 'Your new page title here'');

$xt->assign('metadesc', 'Your meta desc here');

$xt->assign('metakeywords', 'Your Keywords here');

$xt->assign('metarobots', 'index,follow');

$xt->assign('metasubject', 'Your meta subject here');

$xt->assign('metacopyright', 'Your Copyright here');


You can fill meta tags with php variables or field value, for example:

$xt->assign('metakeywords', ''.$values["keywords"].'');


Another example, i want my page title changes dynamically according to current month name and year
In before display event:


$MyCustomMonth = array(

'01' => 'January',

'02' => 'February',

'03' => 'March',

'04' => 'April',

'05' => 'May',

'06' => 'June',

'07' => 'July',

'08' => 'August',

'09' => 'September',

'10' => 'October',

'11' => 'November',

'12' => 'December',

);
$xt->assign('custompagetitle', 'Hosting discounts in '.$MyCustomMonth[date('m')].' '.date('Y').'');


The above code will create page title: Hosting discounts in April 2017
From my experience, using dynamic page title increases page SEO

John Rotella 4/28/2017

Thank you

Note there is one too many apostrophes after the words Your new page title here in Step 2

H
headingwest author 4/28/2017

Many thanks Romaldus, that's perfect.