You are not logged in.

Announcement

Forum database was corrupt and an old backup was restored as temporary replacement. Registrations closed until the database is recovered. Please ask questions using the Contact form

#1 23-05-2013 08:43:47

arthur
Contributors
Registered: 23-03-2013
Posts: 7

SEO - page meta name and description (please add)

Hi Thomas & co,


To improve even more in SEO it would be nice if you could for each page:
- the title
- the description
- the keywords

Now each page gets the information from the site (as defined in general.php). An exampe of the source is:
<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="Description" content="A description of your site for Google here"/>
    <meta name="keywords" content="Some, keywords, seperated, by, commas, here, max 10"/>
    <meta name="viewport" content="width=300, target-densitydpi=150, initial-scale=0.999">
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <title>site name</title>

The pages.php would be the best place to add this infoirmation:
$pageTitles['welcome.php'] = "Welcome";
$pageTitles['typography.php'] = "Typography";
$pageTitles['accordions.php'] = "Accordions";
$pageTitles['sidebars.php'] = "Sidebars";

Idea for Change Request:
1. use the $pageTitles to generate the <title> metatag for each page
2. add new arrays $pageDescription and $pageKeywords to generate the meta tags "Description"  and "keywords".

The new pages.php would become:
$pageTitles['welcome.php'] = "Welcome";
$pageDescription['welcome.php'] = "See the Metro UI tempalte in action on this welcome page.";
$pageKeywords['welcome.php'] = "Metro Design, Flip tiles, etc...";

$pageTitles['typography.php'] = "Typography";
etc

Looking forward to your feedback.


Regards,

Arthur

Offline

#2 24-05-2013 19:19:53

Thomas
Administrator
Registered: 10-03-2013
Posts: 897

Re: SEO - page meta name and description (please add)

The title metatag is generated for each page (in seo.php)

The other things would be good things to add. I'll try to get it ready for the next version.

Offline

#3 02-06-2014 13:44:29

vicslo
Contributors
Registered: 15-11-2013
Posts: 3

Re: SEO - page meta name and description (please add)

Thomas wrote:

The title metatag is generated for each page (in seo.php)

The other things would be good things to add. I'll try to get it ready for the next version.

Versia v4.b3.1  not generated
different page description & page keywords.

Offline

#4 02-06-2014 17:22:03

Thomas
Administrator
Registered: 10-03-2013
Posts: 897

Re: SEO - page meta name and description (please add)

it is possible in v4.b3.1 to set different keywords and page descriptions by:

/* Optional: page descriptions (for Google)*/
$pageDescriptions['welcome.php'] = "This is the welcome page. Welcome.";

/* Optional: page keywords (for Google)(isn't important at all)*/
$pageKeywords['welcome.php'] = "welcome, page, test";
	

Offline

#5 02-06-2014 18:42:00

vicslo
Contributors
Registered: 15-11-2013
Posts: 3

Re: SEO - page meta name and description (please add)

but in firebug I see generated only title metatag
and don't see change page description & page keywords

Last edited by vicslo (02-06-2014 18:51:33)

Offline

#6 02-06-2014 19:18:02

Thomas
Administrator
Registered: 10-03-2013
Posts: 897

Re: SEO - page meta name and description (please add)

They are only visible in the "search engine"-generated page. To check that page, you need to replace
/#!/ in the url by
/?_escaped_fragment_=/

for example:
http://metro-webdesign.info/?_escaped_fragment_=/about

Offline

#7 02-06-2014 21:33:46

vicslo
Contributors
Registered: 15-11-2013
Posts: 3

Re: SEO - page meta name and description (please add)

Yes!!! Thanks. But in seo.php please correct


if(isset($pageKeywords[$reqUrl])){
            $siteMetaKeywords = $pageKeywords[$reqUrl];

Offline

#8 02-06-2014 21:44:14

Thomas
Administrator
Registered: 10-03-2013
Posts: 897

Re: SEO - page meta name and description (please add)

Thanks for reporting that error smile

Offline

#9 15-07-2014 21:26:35

rsalomone
Contributors
Registered: 22-11-2013
Posts: 101
Website

Re: SEO - page meta name and description (please add)

I added an xml load (making it easier for modifying meta data for larger websites.   Just add a meta.xml file to your main folder load the page, title, keywords, description tags all at once.  Then you can reference the $pageTitles[''] without hardcoding them.   I am sure this code can be better optimized but hopefully you can use this as a start.

I put it in  the pages.php file (in config/pages.php);


[== PHP ==]
<?php
/* addded the following load from meta.xml */
$doc = new DOMDocument();
$doc->load( "meta.xml" );
$xpath = new DOMXpath( $doc );
$nodes = $xpath->query( '*' );
$nodeNames = array();
foreach( $nodes as $node )
{
    $pagenode = $node->nodeName;
    $findstr = "//xml/".$pagenode."/*";    
    $elements = $xpath->query($findstr);
    if (!is_null($elements)) {
      foreach ($elements as $element) {
        $nodes = $element->childNodes;
        foreach ($nodes as $node) {
        
        $webpage = $pagenode.".php";
        switch ($node->parentNode->nodeName) {
         case "title": 
           $pageTitles[$webpage] = $node->nodeValue;
           break;
         case "keywords":
	   $pageKeywords[$webpage] = $node->nodeValue;
           break;
         case "description":
	   $pageDescriptions[$webpage] = $node->nodeValue;
           break;
           }
       }
     }
   }    
}
/* end of new code */


?>

Sample meta.xml

[== XML ==]
<?xml version="1.0" ?> 
<xml>

<default>
  <title>Call Accounting Software, Hotel Call Accounting and Real Time Dashboard by RSI</title>      
  <keywords>call accounting, call accounting software, dashboard, CRM Integration, telephone reporting package, pbx administration, mobile tracking, hotel billing, telemanagement software, internet access control, browser surf reporting, SIP Reporting </keywords>
  <description>RSI offers call accounting software, hotel call accounting, healthcare call reporting, PBX traffic analysis, CRM Integration, telephone reporting, cloud based call accounting and mobile tracking software.</description>  
</default>

<index>
  <title>Call Accounting Software, Call Accounting for Enterprise, Hotel, Healthcare | RSI</title>      
  <keywords>call accounting, call accounting software, IPO dashboard, telephone reporting package, Avaya Call Accounting, real time dashboard, healthcare emergency notification, mobile tracking, hotel billing, telemanagement software, SIP Reporting, internet access control, surf browser reporting </keywords>
  <description>RSI offers call accounting software, hotel billing, healthcare call reporting, PBX administration, CRM Integration, telephone reporting, communication expense and switch management software.</description>  
</index>

<contact>
       <title>Contact Us, Resource Software International Ltd. (RSI) Home Page Contact Information</title>
       <keywords>Contact Us, Call Accounting, Hotel Billing, CTI Solutions, Telemanagement, TELECOST, Shadow, tools CTI Pack, Rapport for TAPI, Revolution Software</keywords>
       <description>Contact Us about Telemanagment, Telecom Expense Management and Call Accounting Solutions for Every Enterprise</description>
</contact>

</xml>

Last edited by rsalomone (17-07-2014 17:24:58)

Offline

#10 17-07-2014 17:26:28

rsalomone
Contributors
Registered: 22-11-2013
Posts: 101
Website

Re: SEO - page meta name and description (please add)

Is there a way to transfer the pageTitles to the javascript title for each page?

Offline

#11 27-07-2014 17:53:53

Thomas
Administrator
Registered: 10-03-2013
Posts: 897

Re: SEO - page meta name and description (please add)

What do you mean with javascript title? Variable title? That should already be done automaticly.

Offline

#12 06-08-2014 19:03:12

rsalomone
Contributors
Registered: 22-11-2013
Posts: 101
Website

Re: SEO - page meta name and description (please add)

Thomas,

as you suggested,  I assigned $pageTitles['pagename'] = 'Title of the page' in pages.php.  (see code above as it reads all pagetitles['pagename(s)'] as well as pageKeywords and pageDescription.   However,  I believe they are not assigned unless you use escape_fragment.   Can we not assign the pageTitle to document.title?

I believe there is a bug in phptojs in the way to move the $pageTitles variables to javascript.   Javascript does not support "strings" as indexes into arrays. 

For example, pageTitles['contact.php'] = 'Contact Us';  is not allowed in javascript right?

I created a pageTitleIdx[1] = 'contact.php'; pageTitleIdx[2] = 'overview.php'; etc...
Then I assigned pageTitles[1] = 'Contact Us'; pageTitles[2] = 'Corporate Overview"; etc...
I had to use a function setPageTitle to find the matching entries to the pages.

Last edited by rsalomone (06-08-2014 19:15:22)

Offline

#13 07-08-2014 23:05:48

Thomas
Administrator
Registered: 10-03-2013
Posts: 897

Re: SEO - page meta name and description (please add)

Javascript can have strings as variable keys if the variable is an object (not an array). It could be that I forgot to define it as an array, but it works on my site tongue

Offline

Board footer

Powered by FluxBB