Community @ The Turning Gate

Support community for TTG plugins and products.

You are not logged in.

#1 2017-12-03 20:33:26

lofty
Member
From: UK
Registered: 2012-09-26
Posts: 244
Website

Page Meta Description

Hi Guys,

Forgive me if I have missed a previous discussion and if so kindly point me to the previous..

How can I populate the Meta Description for Home, About, Blog, and Contact Pages? I know that the Album Description in the LR plugin does it for my Photo Albums, but struggling to get the set-up correct using php. I see the meta description line in the head using the Inspector, but the content is blank

Any help much appreciated

Jon

Offline

#2 2017-12-03 23:27:14

rod barbee
Moderator
From: Port Ludlow, WA USA
Registered: 2012-09-24
Posts: 13,606
Website

Re: Page Meta Description

There’s one about description for album sets, but I don’t recall one having to do with descriptions on pages.
http://community.theturninggate.net/vie … hp?id=8276


Rod 
Just a user with way too much time on his hands.
www.rodbarbee.com
ttg-tips.com, Backlight 1.1.1 test site, Pangolin test site

Offline

#3 2017-12-04 02:08:06

lofty
Member
From: UK
Registered: 2012-09-26
Posts: 244
Website

Re: Page Meta Description

Hi Rod,

Yep, that's the one that prompted me to look. The guy has meta descriptions on all the headers on his pages, mine are just blank, must be php I guess. Haven't cracked it yet. sad

Last edited by lofty (2017-12-04 02:08:27)

Offline

#4 2017-12-04 02:28:07

rod barbee
Moderator
From: Port Ludlow, WA USA
Registered: 2012-09-24
Posts: 13,606
Website

Re: Page Meta Description

Jim's site? Could be because he's using WordPress for his pages and not Backlight pages.(Backlight WP theme)


Rod 
Just a user with way too much time on his hands.
www.rodbarbee.com
ttg-tips.com, Backlight 1.1.1 test site, Pangolin test site

Offline

#5 2017-12-04 02:55:51

lofty
Member
From: UK
Registered: 2012-09-26
Posts: 244
Website

Re: Page Meta Description

Could be Rod, just a bit frustrating to have the meta description field there in the head without being able to put anything in it.....

Offline

#6 2017-12-04 03:10:30

charlie.choc
Member
From: Marietta, GA
Registered: 2014-01-09
Posts: 350
Website

Re: Page Meta Description

I just tried using phplugins to add the meta description and keywords to pages using the ttg_head hook at it seems to work but I won't be able to see how it affects search results for a while.

Offline

#7 2017-12-04 03:40:27

Daniel Leu
Moderator
Registered: 2012-10-11
Posts: 772
Website

Re: Page Meta Description

charlie.choc wrote:

I just tried using phplugins to add the meta description and keywords to pages using the ttg_head hook at it seems to work but I won't be able to see how it affects search results for a while.

But then it would be nice to have the twitter and open graph fields set as well.

Maybe the easiest might be to have a ttg_meta hook that can replace the default settings. This way one can target specific pages from phplugins and add whatever one desires.

Maybe even easier, if Backlight would not set empty fields, they could then be easily added with the existing ttg_head hook. I don't know what's happening if the same metadata field is set twice, first without content and then a second time with content.


Daniel Leu | Photography   
DanielLeu.com

Offline

#8 2017-12-04 04:26:52

lofty
Member
From: UK
Registered: 2012-09-26
Posts: 244
Website

Re: Page Meta Description

Exactly Daniel, I thought that I had missed something. We should be able to set page specific meta description and keywords. SEO does not like the same description for all pages.

Offline

#9 2017-12-04 04:42:46

charlie.choc
Member
From: Marietta, GA
Registered: 2014-01-09
Posts: 350
Website

Re: Page Meta Description

You can do page specific using conditional logic in phplugins based on URL which you can get from"https://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"; but I agree it would be nice to have the option to set the variables in Backlight.

Offline

#10 2017-12-04 05:05:43

lofty
Member
From: UK
Registered: 2012-09-26
Posts: 244
Website

Re: Page Meta Description

Easy for you to say Charlie smile

Last edited by lofty (2017-12-04 05:05:53)

Offline

#11 2017-12-04 05:17:26

charlie.choc
Member
From: Marietta, GA
Registered: 2014-01-09
Posts: 350
Website

Re: Page Meta Description

Here's what I added just for fun on my site:

function ttg_head( $style, $path ) {

    $page_id = "$_SERVER[REQUEST_URI]";
   
    if($page_id == '/')
    {
        echo '
            <meta name="description" content="Stalking Light Photography - Fine Art Wilderness Photography by Charlie Choc">
            <meta name="keywords" content="photography,fine art,wilderness,wildlife,landscape,prints,birds,mammals,reptiles,desert,seascapes,mountains,great plains,flowers,waterfalls,fall colors">
        ';
    }
    else if ($page_id == '/about/')
    {
        echo '
            <meta name="description" content="About Stalking Light Photography">
            <meta name="keywords" content="photographer,nikon,lumix,mavic pro">
        ';

    }
  return false;
} // END


Kind of clumsy but it shows the jist of what you can do to add meta data to the home page and the about page. There is also a 'switch' 'case' construct that would be more elegant but 'if' 'else' is easier to explain to a non programmer. ;-)

Last edited by charlie.choc (2017-12-04 05:21:51)

Offline

#12 2017-12-04 05:46:25

rod barbee
Moderator
From: Port Ludlow, WA USA
Registered: 2012-09-24
Posts: 13,606
Website

Re: Page Meta Description

Another thing you can do to add at least descriptions (keywords don't seem to matter much for  SEO any more) is to embed an album in any page and add the description in the album description in Lightroom.
For example, the Contact page on my Pangolin test site: http://pangolin.barbeephoto.com/contact/

I just created an empty album with the description field filled out and hid it from the album set and search. Then embedded the album in the contact page.


Rod 
Just a user with way too much time on his hands.
www.rodbarbee.com
ttg-tips.com, Backlight 1.1.1 test site, Pangolin test site

Offline

#13 2017-12-04 06:01:56

lofty
Member
From: UK
Registered: 2012-09-26
Posts: 244
Website

Re: Page Meta Description

Yes that would work Rod, I thought  I could do that with my home page Theatre embed. Didn't think of an empty album though, that is smart! I might have a play with Charlies php but yours is fun too.

Offline

#14 2017-12-05 03:26:24

lofty
Member
From: UK
Registered: 2012-09-26
Posts: 244
Website

Re: Page Meta Description

OK Rod, you are officially a genius!

The php method described by Charlie does get the meta tags into the header but.... It does leave the empty descriptions behind as well.

By inserting an empty gallery with a description into the page not only is the meta description populated but the open graph description is populated too.

Excellent solution Rod. smile

Offline

#15 2017-12-05 03:33:15

rod barbee
Moderator
From: Port Ludlow, WA USA
Registered: 2012-09-24
Posts: 13,606
Website

Re: Page Meta Description

Just lucky. I noticed my home page had the description metadata, and the only place that appears is in the description of the album I'm using on the home page.


Rod 
Just a user with way too much time on his hands.
www.rodbarbee.com
ttg-tips.com, Backlight 1.1.1 test site, Pangolin test site

Offline

#16 2017-12-05 03:35:31

charlie.choc
Member
From: Marietta, GA
Registered: 2014-01-09
Posts: 350
Website

Re: Page Meta Description

I agree, Rod's solution is a much better way.

Offline

Board footer

Powered by FluxBB