Metatag Description and Open Graph Metatag Description?
slart
Joined: 2013-11-11
Posts: 112 |
![]() |
|||
Hello, Currently I have the text blocks inserted as the description there where I have moved the php code for that. Quote:
themes/clean_canvas/views/info_block.html.php But this is a bad solution because of the meta description is too long. Is there a better solution? I need this only for the start page and the album pages. Please see in the Attachement. Here is a screenshot. (I have it pixelated.)
|
||||
floridave
![]()
Joined: 2003-12-22
Posts: 27300 |
![]() |
|||
Your screen shot does not help at all. Quote:
But this is a bad solution because of the meta description is too long. So you want to truncate the meta tag? Dave |
||||
slart
Joined: 2013-11-11
Posts: 112 |
![]() |
|||
Hi floridave, yes I would like to shorten the text in the meta tag description. I have tried the module text truncate, but that does not work in my Gallery, and bring not probably the solution. |
||||
floridave
![]()
Joined: 2003-12-22
Posts: 27300 |
![]() |
|||
OK how is the meta description generated? Is it a module ( what module) or is it built into the theme? Dave |
||||
slart
Joined: 2013-11-11
Posts: 112 |
![]() |
|||
Hi Dave, I have (now) 2 different meta tags. The normal metatags and the Open Graph meta tags. Normal: <meta name="_______" content="__________" /> The normal are manually inserted into themes/clean_canvas/views/page.html.php. With solid content (not so good). OK, I just think the normal meta tags description could also be in the social share module. tricky ;) |
||||
floridave
![]()
Joined: 2003-12-22
Posts: 27300 |
![]() |
|||
So the social share module has a OG: meta tag for the description you want to be truncated? Dave |
||||
floridave
![]()
Joined: 2003-12-22
Posts: 27300 |
![]() |
|||
Quote:
With solid content (not so good). Explain with code you are using. Dave |
||||
slart
Joined: 2013-11-11
Posts: 112 |
![]() |
|||
Hi Dave, that is the Module social share: http://codex.galleryproject.org/Gallery3:Modules:social_share That is the source code from the modules/social_share/helpers/social_share_themes.php Quote:
<?php defined("SYSPATH") or die("No direct script access."); I have expanded it with the metatag og:description. Thanks to tempg http://galleryproject.org/node/112388#comment-407512 The normal Metatag source code in the themes/clean_canvas/views/page.html.php , which I have added manually. Quote:
<?php defined("SYSPATH") or die("No direct script access.") ?> |
||||
slart
Joined: 2013-11-11
Posts: 112 |
![]() |
|||
It would be nice if the Open Graph meta tags would not be generated in the module social share, but along with the regular meta tags to the page itself, or the theme. PS: I changed the Topic. I had a mistake. The description of the photos is called also description that I have confused with the meta tag description. |
||||
slart
Joined: 2013-11-11
Posts: 112 |
![]() |
|||
I found this, but no idea where I should put this. |
||||
slart
Joined: 2013-11-11
Posts: 112 |
![]() |
|||
Hi Dave, you have no idea? |
||||
slart
Joined: 2013-11-11
Posts: 112 |
![]() |
|||
Wow! I am pleasantly surprised and happy! I've manage it myself. Step by step. - install and activate Module:social share move, change and adapt. /modules/metadescription/views/metadescription_block.html.php at the end Quote:
<meta property="og:description" content="<?= $metaDescription ?>" /> You can insert here more meta tags if you wish. You can determine the length of the characters of the description here. Quote:
// Limit Description to 150 characters. If a Facebook Like is not enabled, then this change yet. make a _ in this lines, and deactivate it. Facebook is your side no longer angry. (see debugger) Quote:
<meta property=\"fb:app_id_\" content=\"$appId\"/> Use the Facebook Debugger to your pages in Facebook reread. Facbook has a cache. |
||||
floridave
![]()
Joined: 2003-12-22
Posts: 27300 |
![]() |
|||
Great! Glad you got it sorted and posted back for the community as well. Cheers! |
||||
MarkRH
Joined: 2007-05-25
Posts: 241 |
![]() |
|||
FYI, I put the following function in my local.php to truncate the description if it's too long: function meta_description($description) { // BEGIN function meta_description $description = strip_tags($description); $description = str_replace('"','',$description); $max_length = 150; if (strlen($description) > $max_length) { $description = substr($description,0,$max_length ) . '...'; } return $description; } // END function meta_description Think I added the quote replacement because if I didn't it would cause a problem Then in my theme's page.html.php file I have: <meta name="description" content="<? echo meta_description($theme->item()->description); ?>" /> <meta property="og:description" content="<?= meta_description($theme->item()->description) ?>" />
I have that Social Share module but either the version I have doesn't output the description information or I took it out LOL. Using Gallery 3.0.9 - gallery.markheadrick.com |
||||