Support Forum

Advanced Search
Forum Scope


Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
general-topic
Increasing Open Graph Description Length
Avatar
FidoSysop
Clearwater Florida
Member

VIP
sp_UserOfflineSmall Offline
Jul 3, 2017 - 9:08 am

G'mornin Everyone.. Happy Holiday.. cool

I'm looking to increase the open graph description output in my forum.

Looks like SimplePress open graph is internally set the same as the meta description length 120 characters or so. It's said Facebook renders around 300 characters, but longer is OK as it will be truncated. 

Is this controlled by a file i can edit?

Thanks, Ed

  • Doc ~ An old Fidonet SysOp. Just hanging out in cyberspace keeping up with tech.
Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
Jul 3, 2017 - 12:20 pm

There isn't any length restriction imposed that I am aware of on the meta description....? Indeed ours is about 300 characters. Or am I confusing this for something else?

andy-signature.png
YELLOW
SWORDFISH
Avatar
FidoSysop
Clearwater Florida
Member

VIP
sp_UserOfflineSmall Offline
Jul 3, 2017 - 1:13 pm

Under SEO there is an option to use the first 120 characters for the topic meta description.

Remembering the open graph (og) inclusion came later. It looks like that 120 characters is duplicated for the og description tag.

These days I'm finding out that og description is too short, especially when sharing to Facebook or Google plus. I'm hoping to bump it up to around 300 characters. The meta description could be safely increased to 160 characters for the best seo.

  • Doc ~ An old Fidonet SysOp. Just hanging out in cyberspace keeping up with tech.
Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Jul 3, 2017 - 9:13 pm

This does seem to be the case if you are using the excerpt option...  I guess the 120 was a typical, albeit arbitrary, size of an excerpt...  

if you like, you can use the 'sph_meta_description' to adjust the meta description as you see fit...  but if you want more chars, you will essentially have to regenerate it...  something like:

global $spVars; global $spVars; 
$content = spdb_table(SFPOSTS, "topic_id={$spVars['topicid']}", 'post_content', 'post_id ASC', 1); 
$description = wp_html_excerpt($content, 120);

but of course change the 120 to what you want...  hook into the filter above, and then add the code above and return $description...

better than changing core code...

Avatar
FidoSysop
Clearwater Florida
Member

VIP
sp_UserOfflineSmall Offline
Jul 4, 2017 - 8:01 am

Thanks for that info, Steve.

What sp file would that be in?

Preferably only change the open graph description length.

  • Doc ~ An old Fidonet SysOp. Just hanging out in cyberspace keeping up with tech.
Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
Jul 4, 2017 - 9:29 am

if you mean where is it best to put the code then the best way is to create a new file in the wp-content folder named 'sp-user-functions.php' and use that. This file will never be touched by any upgrades.

andy-signature.png
YELLOW
SWORDFISH
Avatar
FidoSysop
Clearwater Florida
Member

VIP
sp_UserOfflineSmall Offline
Jul 6, 2017 - 8:00 am

Created the file and put it in the wp-content directory. Something was echoed to the top of the screen, and the length did not increase. Would i have to uncheck the 120 characters in the seo component settings?

Is there a core file i can edit to increase the characters?

Thanks.. confused

  • Doc ~ An old Fidonet SysOp. Just hanging out in cyberspace keeping up with tech.
Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Jul 6, 2017 - 9:42 am

not sure I follow...  you did something like this??

add_filter('sph_meta_description', 'my_meta_description'); 
function sph_meta_description($description) { 
global $spVars; 
$content = spdb_table(SFPOSTS, "topic_id={$spVars['topicid']}", 'post_content', 'post_id ASC', 1);
$description = wp_html_excerpt($content, 300); 
return $description; 
}

shouldnt echo anything...  search for the $description line in the core files and you will find it...

Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
Jul 6, 2017 - 11:26 am

Did you wrap the code in php tags. If you didn't then that could echo...

andy-signature.png
YELLOW
SWORDFISH
Avatar
FidoSysop
Clearwater Florida
Member

VIP
sp_UserOfflineSmall Offline
Jul 6, 2017 - 12:45 pm

Ahhhh.. Wrapped it but no change in the description length. You say core files? Not sure what those would be? Browsed around in a few with a text editor find function but couldn't find $description

  • Doc ~ An old Fidonet SysOp. Just hanging out in cyberspace keeping up with tech.
Forum Timezone: Europe/Stockholm
Most Users Ever Online: 1170
Currently Online:
Guest(s) 1
Currently Browsing this Page:
1 Guest(s)
Top Posters:
Mr Papa: 19448
Ike: 2086
Brandon: 864
kvr28: 804
jim: 650
FidoSysop: 577
Conrad_Farlow: 531
fiddlerman: 358
Stefano Prete: 325
Member Stats:
Guest Posters: 620
Members: 17365
Moderators: 0
Admins: 4
Forum Stats:
Groups: 7
Forums: 17
Topics: 10128
Posts: 79626