Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
PROBLEM Sharing content on Facebook (News Manager)
#1
A website I created is using News Manager, and the posts must be shared on Facebook.
The problem is the shared content doesn't look right on Facebook:

- no pictures of the post are displayed
- the content isn't served correctly either

I'm trying to share this link via News Manager:
http://iracydematos.com.br/index.php?id=...municipais

SCREENSHOT 1: the content  https://ibb.co/cTZ4kk
SCREENSHOT 2: how it appears in Facebook https://ibb.co/gq7ArQ

Notice that the actual image of the post does not appear (the sidebar image of the site appears) and the written content is also different. 

I would appreciate any light that could be shed on this matter.

Thank you
Reply
#2
First of all, you should remove the canonical meta, that by default links to the news page instead of the post url. To do so, edit your template and change get_header(); to get_header(false);
Reply
#3
Also, you can add something like this to your template, before the </head> closing tag:

PHP Code:
<?php if (nm_is_single()) { ?>
  <meta property="og:title" content="<?php nm_post_title(); ?> - Notícias - Iracy de Matos Guerreira" /> 
  <meta property="og:image" content="<?php nm_post_image_url(0,0); ?>" /> 
  <meta property="og:description" content="<?php nm_post_excerpt(300"..."); ?>" /> 
  <meta property="og:url" content="<?php nm_post_url(); ?>">
<?php ?>
Reply
#4
(2017-04-13, 17:04:51)Carlos Wrote: Also, you can add something like this to your template, before the </head> closing tag:

PHP Code:
<?php if (nm_is_single()) { ?>
  <meta property="og:title" content="<?php nm_post_title(); ?> - Notícias - Iracy de Matos Guerreira" /> 
  <meta property="og:image" content="<?php nm_post_image_url(0,0); ?>" /> 
  <meta property="og:description" content="<?php nm_post_excerpt(300"..."); ?>" /> 
  <meta property="og:url" content="<?php nm_post_url(); ?>">
<?php ?>

I have a error with this meta tags:


Code:
<meta property="og:locale" content="pt_BR">
<meta property="og:title" content="<?php get_page_title(); ?>" />
<meta property="og:image" content="<?php get_page_content(); ?>" />
<meta property="og:image:url" content="<?php get_page_content(); ?>" />
<meta property="og:type" content="article" />
<meta property="article:author" content='https://www.facebook.com/iracydematosguerreira' />
<meta property="og:image:width" content="1200" />
<meta property="og:image:height" content="630" />
<meta property="og:description" content="<?php get_page_excerpt(300, "..."); ?>" />
<meta property="og:url" content="<?php get_page_url(); ?>" />
<meta property="fb:admins" content="100009032308962" />

<?php if (nm_is_single()) { ?>
<meta property="og:locale" content="pt_BR">
<meta property="og:type" content="article" />
<meta property="article:author" content='https://www.facebook.com/iracydematosguerreira' />
<meta property="og:title" content="<?php nm_post_title(); ?>" />
<meta property="og:image" content="<?php nm_post_image_url(0,0); ?>" />
<meta property="og:image:url" content="<?php nm_post_image_url(0,0); ?>" />
<meta property="og:image:width" content="1200" />
<meta property="og:image:height" content="630" />
<meta property="og:description" content="<?php nm_post_excerpt(300, "..."); ?>" />
<meta property="og:url" content="<?php nm_post_url(); ?>" />
<meta property="fb:admins" content="100009032308962"/>
<?php } ?>

http://iracydematos.com.br/noticias/

Please, how to fix?
Reply
#5
You shouldn't use get_page_content() for the image url metas! That function inserts the whole page content.

Also, you'd better separate your meta tags for pages and posts like this:

Code:
<?php if (nm_is_single()) { ?>

... META TAGS FOR POSTS ...

<?php } else { ?>

... META TAGS FOR PAGES ...

<?php } ?>
Reply
#6
(2017-04-18, 05:15:26)Carlos Wrote: You shouldn't use get_page_content() for the image url metas! That function inserts the whole page content.

Also, you'd better separate your meta tags for pages and posts like this:

Code:
<?php if (nm_is_single()) { ?>

... META TAGS FOR POSTS ...

<?php } else { ?>

... META TAGS FOR PAGES ...

<?php } ?>

Thank you Carlos!

Sorry for my bad code and bad english but...

Someone could help me to get images from the body of the pages in og:image meta tag?
Reply
#7
Hello, For getting this automatically from the body, i really can't help...
for now, I don't use any plugin for the news manager...

In fact i just use the pagify function to split my news homepage, as i don't write much often... i am using custom component, which goes on pair with the Special Pages + Custom fileds plugin by MVLECK.

Just in case, here is my component code:

<!-- Schema.org markup for Google+ -->
<meta itemprop="name" content="<?php get_page_clean_title(); ?>">
<meta itemprop="description" content="<?php get_page_meta_desc(); ?>">
<meta itemprop="image" content="<?php get_site_url(); ?><?php getPageContent('socialdata','socialimgfolder'); ?><?php get_custom_field('socialimg'); ?>">

<!-- Open Graph data -->
<meta property="og:title" content="<?php get_page_clean_title(); ?>" />
<meta property="og:description" content="<?php get_page_meta_desc(); ?>" />
<meta property="og:image" content="<?php get_site_url(); ?><?php getPageContent('socialdata','socialimgfolder'); ?><?php get_custom_field('socialimg'); ?>" />
<meta property="og:url" content="<?php get_page_url(); ?>" />
<meta name="twitter:card" content="<?php get_site_url(); ?><?php getPageContent('socialdata','socialimgfolder'); ?><?php get_custom_field('socialimg'); ?>" />

So, if i create a special page "blog", then i have my special page with the Custom fields showing up.
The problem is that this is really basic, and needs manual action to declare what is the img post.
Reply
#8
Yes!

I use Custom Fields Plugin with:
Name: socialimg
Label: Facebook JPG
Type: Image
Default Value: empty

In the head of my template.php:
<meta property="og:image" content="<?php get_custom_field('socialimg'); ?>" />
<meta property="og:image:url" content="<?php get_custom_field('socialimg'); ?>" />

Thanks to dedos, Carlos an zekoolweb!!!! Thanks to the developers for such a great CMS!
Reply




Users browsing this thread: 1 Guest(s)