bryanlewis Posted May 31, 2020 Report Share Posted May 31, 2020 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 Quote Link to comment Share on other sites More sharing options...
bryanlewis Posted June 1, 2020 Author Report Share Posted June 1, 2020 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. Quote Link to comment Share on other sites More sharing options...
Ken Roy Posted June 1, 2020 Report Share Posted June 1, 2020 $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. Quote Link to comment Share on other sites More sharing options...
bryanlewis Posted June 1, 2020 Author Report Share Posted June 1, 2020 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 Quote Link to comment Share on other sites More sharing options...
Ken Roy Posted June 1, 2020 Report Share Posted June 1, 2020 You could take a look at the Simple SEO mod. Personally, I was never concerned about any SEO since the rules are forever changing. Quote Link to comment Share on other sites More sharing options...
bryanlewis Posted June 1, 2020 Author Report Share Posted June 1, 2020 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 Quote Link to comment Share on other sites More sharing options...
jrueger Posted September 9, 2020 Report Share Posted September 9, 2020 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 😁 Quote Link to comment Share on other sites More sharing options...
bryanlewis Posted September 9, 2020 Author Report Share Posted September 9, 2020 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 Quote Link to comment Share on other sites More sharing options...
jrueger Posted September 11, 2020 Report Share Posted September 11, 2020 Thanks for the answer - pretty clever solution! I'll continue to experiment and see how much I can customize things. Jeff Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.