Jump to content
TNG Community

Custom Page Title and Descriptions


bryanlewis

Recommended Posts

bryanlewis

I am trying to figure out how to customize the page title (<title> tag) for the Person and Family pages, as well as set a custom meta description (<meta name="Description">).  Currently, TNG sets these two things to the same value and for SEO purposes, I would like to adjust them.  I have searched through the codebase a bit and searched the forum, but I cannot figure out where these values are being set.  Any pointers would be appreciated.

Thanks,

Bryan

Link to comment
Share on other sites

bryanlewis

I found where the page title and description were being set -- in the tng_header() method in genlib.php. Unfortunately, they are hardcoded to be the same value (the $title variable passed into tng_header).  So there is no simple way to make the meta description different.  :(

Link to comment
Share on other sites

$title is a variable you pass when calling the tng_header function.   On Custom pages, your should be in control of the title.  On the getperson.php page, TNG sets the title to the person's name, birth and death dates of the person being display.  It does something similar with the Family page display.

The <title> is different on every getperson.php and familychart.php or familygroup.php page.

Link to comment
Share on other sites

bryanlewis

Yes, I figured that part out Ken.  Thanks.  I did do some custom adjustments to the title.  But the meta description is also going to be whatever the title is set to. 

Google's SEO isn't a big fan of having the title and description being set to the exact same thing, and it looks odd in the search results to have the information duplicate.  That's why I was trying to set them to different strings.

Bryan

Link to comment
Share on other sites

You could take a look at the Simple SEO mod.  Personally, I was never concerned about any SEO since the rules are forever changing.

Link to comment
Share on other sites

bryanlewis

Thanks again for the recommendation.  I tweaked things myself manually to get what I wanted.  Now I just need to create a private mod out of it so I don't forget when the next update hits.

Bryan

Link to comment
Share on other sites

  • 3 months later...

Bryan - I've been trying to do the same thing using either/or meta.php or Simple SEO without much success.  Using meta.php gives the same title, description, etc for every page (unless one used variables and I haven't dabbled around too much with that yet) and Simple SEO gives the same value for Title and Description. So ...

Pray tell how did you "manually tweak things" ... or perhaps you might even release it as a public mod 😁

Link to comment
Share on other sites

jrueger, I actually created a copy of the "tng_header()" method inside of genlib.php and changed it a bit.  The original tng_header looked like this:

function tng_header( $title, $flags )

and I created a new tng_header2 that added a specific meta description parameter:

function tng_header2( $title, $metadesc, $flags )

Then I could call this new method from getperson.php, familygroup.php, etc and pass in a customized metadata description string.  It's a hack and I have not yet created a mod for it, so any TNG updates would crush my changes at this point, but it works well for my needs.  I created a copy of tng_header so that I only had to alter those pages where I wanted to use this new function and all of the other pages can continue to use the original tng_header method without issues.

If you Google "Moses Edward Lewis" (with the quotes), you will see an example of my person and family group sheet pages being returned with custom descriptions (my site is genealogy.lewisfamily.us)

Cheers,

Bryan

Link to comment
Share on other sites

Thanks for the answer - pretty clever solution!  I'll continue to experiment and see how much I can customize things.

Jeff

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...