Jump to content
TNG Community
miloz

Meta Tags

Recommended Posts

miloz

I would like to edit the info that displays in meta name for Keywords and Description.

If view Source on my home page, I see:

<head>

<title>Our Family Genealogy Pages</title>

<link href="genstyle.css" rel="stylesheet">

<meta http-equiv="Content-type" content="text/html; charset=ISO-8859-1">

<meta name="Keywords" content="Our Family Genealogy Pages">

<meta name="Description" content="Our Family Genealogy Pages">

</head>

If I look at the file: meta.html that I uploaded to my hosting provider - it is completely empty.

Which file do I edit to modify "Keywords" and "Description"? Can’t seem to find the file that currently places the generic "Our Family Genealogy" Pages info in these fields.

I am using Programmers Notepad to view these files.

Thanks.

Share this post


Link to post
Share on other sites
arnold

Which file do I edit to modify "Keywords" and "Description"? Can’t seem to find the file that currently places the generic "Our Family Genealogy" Pages info in these fields.

If I understand your question correctly, it is your index file that you edit, which might be named index.htm, index.html, index.asp, index.php, etc.

You might want to replace "Our Family Genealogy Pages" with words that better describe your website. If you are new to this, you might want to show us what you come up with.

Share this post


Link to post
Share on other sites
rdmorss

In genlib.php there is a function called tng_header which is used to display the <head> section of a page in TNG.

Assuming your homepage is index.php you can call this function and provide the page title as a parameter, which TNG will use for title, description, and keywords:

<?php

tng_header( "Your title here", "" );

?>

Share this post


Link to post
Share on other sites
miloz

I modified genlib and added keywords and description. Now when I view my home page and click on View, Source, the meta tags display my entries. Thanks for helping me figure that out.

However, when I go under file to view properties, it still says Our Family Genealogy Pages. From View Source on my web page:

<head>

<title>Our Family Genealogy Pages</title>

<link href="genstyle.css" rel="stylesheet">

I tried entering my verbiage after tng header,but I can't figure out the syntax, so my page displayed as an blank with error codes. I am using the genlib with meta tags so my site is fine, but still can't figure out where I actually place my verbiage. Again, any assistance is welcome.

Share this post


Link to post
Share on other sites
arnold

You almost have it done correctly. Just a little more.

Here is what you currently have:

<head>

<title>Our Family Genealogy Pages</title>

<link href="genstyle.css" rel="stylesheet">

<meta http-equiv="Content-type" content="text/html; charset=ISO-8859-1">

<meta name="Keywords" content="Genealogy, Zarakov, Sheik, Utan, Wolk, Mindus, Berly, Berlly, Zeicheck, Steisal, Sheik, Ash, Assa, Kaminsky, Houdash, Houdish, Houdush, Huddish, photos, histories, other documents">

<meta name="Description" content="Zarakov Family History Web Pages">

</head>

At this time, you might want to change "<title>Our Family Genealogy Pages</title>" to "<title>Zarakov Family History Web Pages</title>."

Your keywords need some tweaking. If many of your ancestors are from various cities/countries throughout the world, you might want to list the major cities/countries. I am not sure that "other documents" helps as a keyword. Keywords are critically important as search engines look specifically for these words.

Share this post


Link to post
Share on other sites
rdmorss

Actually it is easier to just use meta.html to customize your keywords and description. It saves you the trouble of having to edit genlib.php every time there is an update to TNG. This will generate a second set of keyword and description <meta> tags in your pages, but that's OK - it is valid HTML 4.01 Transitional according to http://validator.w3.org

For the page title, don't add it to meta.html. Just include it as the first parameter in the function call for your header:

tng_header("Your Page Title","");

This function generates the entire <head> section of your php pages. It pulls in meta.html in the process.

Share this post


Link to post
Share on other sites
arnold

Robert,

Where I think you and I differ on our approaches to this issue is that my opening/main page is not a TNG file. My opening/main page is a plain ol' html file. It does not change with Darrin's updates. It has nothing to do with genlib.php.

I failed to consider how most everyone else uses TNG. Thanks for jumping in with a relevant solution.

Share this post


Link to post
Share on other sites
miloz

Thanks - title, key words and description problem has now been resolved.

Share this post


Link to post
Share on other sites
redleader

I think the 'neat' code way to do this is to only modify 'genlib.php' file or to remove the 'tng_header' proceedure otherwise we get duplications which many search engines will ignore or ban you for bad or duplicate coding.

Can we just have the meta.html file contain the complete <head> ... </head> tag contents

Share this post


Link to post
Share on other sites
steve30000

Has anyone figured out a way to add more information to the Description meta tag? It seems as though when Google does index your site, it only gets the name from the description meta tag and then gets caught up in all the text at the top of the page (menu items and such) so that the snippet of text displayed is not very useful. This is just a sample I grabbed from one of Darren's listings on Google:

William CRISP

William CRISP. ... Documents · Histories · Headstones · Notes · Sources · Places · Dates & Anniversaries · What's New · Reports · Database Statistics Help ...

www.lythgoes.net/genealogy/getperson.php?personID=I8739 - 16k - Supplemental Result -

I've seen this same type of information for other TNG users listed on Google so I don't think it is an isolated incident. If someone's pages are listed differently, I'd be interested in seeing their layout.

Ideally, it would be helpful if it gave more information about the person such as birth date, death date, and marriage information.

Steve

Share this post


Link to post
Share on other sites
sjwinslow

Has anyone figured out a way to add more information to the Description meta tag? It seems as though when Google does index your site, it only gets the name from the description meta tag and then gets caught up in all the text at the top of the page (menu items and such) so that the snippet of text displayed is not very useful. This is just a sample I grabbed from one of Darren's listings on Google:

I've seen this same type of information for other TNG users listed on Google so I don't think it is an isolated incident. If someone's pages are listed differently, I'd be interested in seeing their layout.

Ideally, it would be helpful if it gave more information about the person such as birth date, death date, and marriage information.

Steve

Well when I read your post I was intrigued. And even though I'm certinaly not a PHP programmer (as you can tell by the solution below) the code changes are easy even though they are crude.

Note: I only added this code to getperson.php. I have no idea if similar change will work on other pages.

1) First get a copy of you getperson.php (Please make a back up copy of the file before you make any changes)

2) Open getperson.php with a text editor like notepad.

3) Search for a line that looks like: tng_header( $namestr, $flags );

4) Replace that line with:

if ($row[living]) {

tng_header( "$namestr", $flags );

}

else {

tng_header( "$namestr b.$row[birthdate] $row[birthplace] d.$row[deathdate] $row[deathplace]", $flags );

} (Note: This code updated on 10/07/07 to ensure living dates don't show)

5) Save the changes and load them to your host server

6) Do an individual look up on your site to make sure everything still looks ok

7) From your browser do a view source and you should see the lines similar to the ones below being included in the source.

<title>William Buell Reyman b.26 May 1864 Salem, Washington, Indiana d.Y </title>

<meta name="Keywords" content="William Buell Reyman b.26 May 1864 Salem, Washington, Indiana d.Y ">

<meta name="Description" content="William Buell Reyman b.26 May 1864 Salem, Washington, Indiana d.Y ">

That's all there is to it.

I guess we'll see if the search engines will display this information.

Steve

Share this post


Link to post
Share on other sites
Ken Roy

Steve,

What a great idea. This topic should probably be moved to TNG Customization.

Ken

Share this post


Link to post
Share on other sites
Rush

I started messing around with the above suggestions because I think its interesting. I had a few comments / suggestions:

When changing the tng_header function, I saw (at least on my site) that two sets of keyword / descriptions were generated. The first picked up by Google and the second ignored.


Title: Krieger family genealogy
X-Meta-Description: Krieger family tree with the extended Egler, Krebs, Egler, Lawrence, Comstock and many more families included.
X-Meta-Description: Vermillion Lulu b.1880 Missouri, USA d.
X-Meta-Keywords: Krieger, egler, krebs, mitchell, filip, family, tree, genealog, genealogy, germany, prussia, ancestry, comstock, stuhler, amman, related, relationships, gendex
X-Meta-Keywords: Vermillion Lulu b.1880 Missouri, USA d.
X-Meta-Robots: index,follow


Results:
Title:    Title meta tag contains no errors.
This tag contains 24 characters.

Title relevancy to page content is excellent.
The Title relevancy to page content is 100%.

Description:    Description relevancy to page content is very poor.
The Description relevancy to page content is 25%.

Keywords:    Keyword relevancy to page content is terrible.
The keywords relevancy to page content is 17%.

The first set is generated by the meta.html file and the second by genlib.php (please correct me if I'm wrong on that one) So, I pondered this idea. Change the meta.hmtl to a php like this:

<?php
echo "<link href=\"genstyle.css\" rel=\"stylesheet\" type=\"text/css\">\n";

echo "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n\n";
    echo "<!-- $tng_title, v.$tng_version ($tng_date), Written by Darrin Lythgoe, $tng_copyright -->\n";
echo "<meta name=\"description\" content=\"$title Krieger family tree with the extended Egler, Krebs, Egler, Lawrence, Comstock and many more families included. \">\n";

echo "<meta name=\"keywords\" content=\"$title Krieger, egler, krebs, mitchell, filip, family, tree, genealog, genealogy, germany, prussia, ancestry, comstock, stuhler, amman, related, relationships, gendex\">\n";
?>
If you notice, it has the $title string at the begining description and keywords tags.

Title: Vermillion Lulu b.1880 Missouri, USA d.
X-Meta-Description: Vermillion Lulu b.1880 Missouri, USA d.  Krieger family tree with the extended Egler, Krebs, Egler, Lawrence, Comstock and many more families included.
X-Meta-Description: Vermillion Lulu b.1880 Missouri, USA d.
X-Meta-Keywords: Vermillion Lulu b.1880 Missouri, USA d.  Krieger, egler, krebs, mitchell, filip, family, tree, genealog, genealogy, germany, prussia, ancestry, comstock, stuhler, amman, related, relationships, gendex
X-Meta-Keywords: Vermillion Lulu b.1880 Missouri, USA d.

Results:
Title:    Title meta tag contains no errors.
This tag contains 39 characters.

Title relevancy to page content is good.
The Title relevancy to page content is 67%.

Description:    Description relevancy to page content is poor.
The Description relevancy to page content is 36%.

Keywords:    This tag contains too many keywords.
This tag contains 24 keywords. This is too many for what we would consider a 'robot friendly' web page. The maximum number of keywords we recommend for this tag is 20.

Keyword relevancy to page content is very poor.
The keywords relevancy to page content is 29%.

Some pages come up with better relevancy due to children listed on the page. This would work with places/cemeteries/etc.

Drawback--it pushes the keywords over 20 (that's fixable). Not saying its a great improvement just kind of kicking around some ideas. :cool:

Oh ya, no making fun of my naked keywords :shock:

Rush

Share this post


Link to post
Share on other sites
Rush

Ok, this might be clunky and meta overkill. But this works a little better with normal meta rules.

Inserts the title, but strips and reinserts commas in the correct locations for keywords.


<?php

//reinsert commas for keywords
function SepStr($str, $enddiv = ",", $minlen = 0, $begindiv = " ")
{
    $ar = explode($begindiv, $str);

    if ( $enddiv{strlen($enddiv)-1} != "" ) { $enddiv .= " "; }
    foreach($ar as $key => $val)
    {
        if (strlen($val) < $minlen)
        {
            unset($ar[$key]);
        }
    }

    $new = implode($enddiv, $ar);
    return $new;
}

$metakeywords = SepStr($newtitle, ",", 4);
$metakeywords = ereg_replace(',,',',', $metakeywords);

//output META Tags
echo "<link href=\"genstyle.css\" rel=\"stylesheet\" type=\"text/css\">\n";

echo "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n\n";
echo "<!-- $tng_title, v.$tng_version ($tng_date), Written by Darrin Lythgoe, $tng_copyright -->\n";
echo "<meta name=\"description\" content=\"$newtitle Krieger family tree with the extended Egler, Krebs, Egler, Lawrence, Comstock and many more families included. \">\n";

echo "<meta name=\"keywords\" content=\"$metakeywords Krieger, egler, krebs, mitchell, filip, family, tree, genealog, genealogy, germany, prussia, ancestry, comstock, stuhler, amman, related, relationships, gendex\">\n";
echo "<META name=\"robots\" content=\"index,follow\">\n";

Rush

EDIT: Cleaned up the double commas generated...looks better now.

Share this post


Link to post
Share on other sites
steve30000

Changing the information sent to the tng_header function worked perfectly for me. Just checked Google and my people are now being listed as:

Marie Madeleine Lévesque b.29 Sep 1710 Rivière-Ouelle,,Kamouraska ...

Marie Madeleine Lévesque b.29 Sep 1710 Rivière-Ouelle,,Kamouraska,Québec,Canada, d.1781.

www.hooverfamily.com/genealogy_new/getperson.php?personID=I963&tree=HOOVER - 18k -

instead of:

Marie Fortin

Marie Fortin. ... Documents · Histories · Headstones · Notes · Sources · Places · Dates & Anniversaries · What's New · Reports · Database Statistics Help ...

www.hooverfamily.com/genealogy_new/getperson.php?personID=I2713&tree=HOOVER - 15k -

Share this post


Link to post
Share on other sites
Rush

Steve,

Not sure why mine is spitting out two sets of descriptions / keywords

(Well, I suspect I know why, but not positive yet)

From 'meta.php'


<meta name="description" content="McMullen Richard b.04 May 1839 Ohio, USA d.09 Nov 1917 Wood, West Virginia, USA Krieger family tree with the extended Egler, Krebs, Egler, Lawrence, Comstock and many more families included. ">
<meta name="keywords" content="McMullen, Richard, b.04, 1839, Ohio, d.09, 1917, Wood, West, Virginia, Krieger, egler, krebs, mitchell, filip, family, tree, genealog, genealogy, germany, prussia, ancestry, comstock, stuhler, amman, related, relationships, gendex">
Generated by something else below right below the above meta tags (genlib.php maybe)

<meta name="Keywords" content="McMullen Richard b.04 May 1839 Ohio, USA d.09 Nov 1917 Wood, West Virginia, USA">
<meta name="Description" content="McMullen Richard b.04 May 1839 Ohio, USA d.09 Nov 1917 Wood, West Virginia, USA">

Using meta.html causes the double description/keywords also.

This second set is ignored by the search engine. The modification to tng_header was modifying the second set so it was not seen by a search engine.

URL I'm looking at:

http://www.bythedrop.com/getperson.php?per...10&tree=Krieger

Dunno...

Rush

Share this post


Link to post
Share on other sites
steve30000

Rush,

The tng_header function in your genlib.php file has the include meta.php function right before it outputs the regular meta tags.


    include( $custommeta );
    if( isset( $flags[tabs] ) )
        echo "<link href=\"$cms[tngpath]" . "$flags[tabs]\" rel=\"stylesheet\" type=\"text/css\">\n";
    if( $session_charset )
        echo "<meta http-equiv=\"Content-type\" content=\"text/html; charset=$session_charset\">\n";
    echo "<meta name=\"Keywords\" content=\"$title\">\n";
    echo "<meta name=\"Description\" content=\"$title\">\n";

Like you said, the second set is ignored but if you want to get rid of them for any reason you can just delete those two lines that echo the keywords and description.

Share this post


Link to post
Share on other sites
Rush

Thats what was causing the head scratcher... I commented them out before and it still displayed.

Let me try that again, maybe messed it up the first time.

EDIT: Yup, commenting them out worked, must have not saved, not uploaded, etc. last time when I did that. It's that little attention to detail ;)

Rush

Share this post


Link to post
Share on other sites
Rush

Well after a little more messing around, I thought I would post a little bit better meta.php code:

It will do seperate keywords for the index.php page and individual pages (getperson.php)

Pushing all of the individual pages title/keyword/description relevancy to 80%+ on my pages instead of the ~20%


<?php

//reinsert commas for keywords and strip double commas
function SepStr($str, $enddiv = ",", $minlen = 0, $begindiv = " ")
{
    $ar = explode($begindiv, $str);

    if ( $enddiv{strlen($enddiv)-1} != "" ) { $enddiv .= " "; }
    foreach($ar as $key => $val)
    {
        if (strlen($val) < $minlen)
        {
            unset($ar[$key]);
        }
    }

    $new = implode($enddiv, $ar);
    return $new;
}

$metakeywords = SepStr($title, ",", 4);
$metakeywords = ereg_replace(',,',',', $metakeywords);

//check to see if we are at home page
$metaurl=$_SERVER['PHP_SELF'];

if ($metaurl=="/index.php") {
    echo "<link href=\"genstyle.css\" rel=\"stylesheet\" type=\"text/css\">\n";
    echo "<meta name=\"description\" content=\"***PUT HOME PAGE DESCRIPTION HERE***\">\n";
    echo "<meta name=\"keywords\" content=\"***PUT HOME PAGE KEYWORDS HERE***\">\n";
    
} else {
  
//output Individuals META Tags
echo "<link href=\"genstyle.css\" rel=\"stylesheet\" type=\"text/css\">\n";
echo "<meta name=\"description\" content=\"$title\">\n";
echo "<meta name=\"keywords\" content=\"$metakeywords\">\n";
}
echo "<meta name=\"robots\" content=\"index,follow\">\n";
?>

Share this post


Link to post
Share on other sites
Steve DC

Actually it is easier to just use meta.html to customize your keywords and description. It saves you the trouble of having to edit genlib.php every time there is an update to TNG. This will generate a second set of keyword and description <meta> tags in your pages, but that's OK - it is valid HTML 4.01 Transitional according to http://validator.w3.org

For the page title, don't add it to meta.html. Just include it as the first parameter in the function call for your header:

tng_header("Your Page Title","");

This function generates the entire <head> section of your php pages. It pulls in meta.html in the process.

Robert - I hope you can help me as I wanted to follow your advice about using meta.html for the keywords and descriptions. Also, I want to change "Home Page" to something more useful. I just need your help in the proper syntax and where to put all of this in meta.html (While I use FrontPage for my wife's website - and am familiar with meta tags - it was easy and I didn't need to know html.)

Here is the current contents of my meta.html file:

<link href="genstyle.css" rel="stylesheet" type="text/css">

<link rel="alternate" type="application/rss+xml" title="RSS" href="tngrss.php">

And the next step is? I sure appreciate the help!

STEVE

Share this post


Link to post
Share on other sites
B McFadyen

Great idea regarding the Page Title, looks a little nicer too. I applied this several weeks ago to my site and after trying it out I quickly added a small change. I added a check for the allow_living flag. If living, I use the old style title, else the new style title.

The issue for me was I did not want the living info (birth date) showing in the title.

Great idea. I meant to post this suggestion a couple weeks back.

Brian

Share this post


Link to post
Share on other sites
Reginald Vaughn Finley Sr

For others still interested in trying to figure out better ways to edit your index.php page to make the meta tags more reflect what you want.

You can simply strip out the tng_header line altogether and enter in your meta tags manually. This way, the front page will more reflect the meta tags you want.

Look at my meta tags as an example. http://www.familyoriginstree.com

Of course, when you update to a later version, you must remember you made this change and re-enter the meta tags manually. The meta.html page is irrelevant at this point.

Example: In index.php find:


tng_header( "Our Family Genealogy Pages", $flags );
Remove that and then enter your meta tags manually. Example.

echo "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n";
echo "\n";
echo "<html>\n";
echo "<head>\n";
echo "<title>The Clam Clam Family</title>\n";
echo "<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=ISO-8859-1\">\n";
echo "<META HTTP-EQUIV=\"EXPIRES\" CONTENT=\"0\">\n";
echo "<META NAME=\"RESOURCE-TYPE\" CONTENT=\"DOCUMENT\">\n";
echo "<META NAME=\"DISTRIBUTION\" CONTENT=\"GLOBAL\">\n";
echo "<META NAME=\"AUTHOR\" CONTENT=\"Zaboomafoo\">\n";
echo "<META NAME=\"COPYRIGHT\" CONTENT=\"Copyright (c) StarDate 3079\">\n";
echo "<meta name=\"Description\" content=\"Just a fictional Example.\">\n";
echo "<META NAME=\"KEYWORDS\" CONTENT=\"blah, blah, blah\">\n";
echo "<META NAME=\"ROBOTS\" CONTENT=\"INDEX, FOLLOW\">\n";
echo "<META NAME=\"REVISIT-AFTER\" CONTENT=\"1 DAYS\">\n";
echo "<META NAME=\"RATING\" CONTENT=\"GENERAL\">\n";
echo "<META NAME=\"GENERATOR\" CONTENT=\"The Next Generation of Genealogy Sitebuilding by Darrin Lythgoe\">\n";
echo "<link href=\"genstyle.css\" rel=\"stylesheet\" type=\"text/css\">\n";
echo "<link rel=\"alternate\" type=\"application/rss+xml\" title=\"RSS\" href=\"tngrss.php\">\n";

I threw in extra meta tags just to show a longer list and options.

I hope this helps someone.

Share this post


Link to post
Share on other sites
delphi

Great idea regarding the Page Title, looks a little nicer too. I applied this several weeks ago to my site and after trying it out I quickly added a small change. I added a check for the allow_living flag. If living, I use the old style title, else the new style title.

The issue for me was I did not want the living info (birth date) showing in the title.

Great idea. I meant to post this suggestion a couple weeks back.

Brian

Thanks for the great ideas in this topic but I was just wondering how I would add this check so that living info was not included in the meta tags ?

Share this post


Link to post
Share on other sites
B McFadyen

Thanks for the great ideas in this topic but I was just wondering how I would add this check so that living info was not included in the meta tags ?

The placement of the code will depend on the page and meta tag coding you have done. The code to check the living flag looks like:


if ( $allow_living_db ) {

lines with your living metat tag info

} else {

alternate lines with living tag info removed

}

Hope that helps.

Brian

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×