Forums

[resolved] Post meta description is not shown on facebook when sharing link (8 posts)

  1. nikhu07
    Member
    Posted 5 months ago #

    Hi,
    My site's address is http://svolze.com
    When I try to share my posts on my facebook profile it shows no excerpt/description. While on search engine, google+ and other sites display it correctly. In my header I found that my theme does not contain meta description tag. Should I put it? Though I am using yoast SEO plugin the problem persists. I have tried putting the following codes still it can't help me

    <?php if (is_single() || is_page() ) : if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    <meta name="description" content="<?php the_excerpt_rss(); ?>" />
    <?php endwhile; endif; elseif(is_home()) : ?>
    <meta name="description" content="<?php bloginfo('description'); ?>" />
    <?php endif; ?>
    <?php if (is_single() || is_page() ) : if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    <meta name="description" content="<?php the_content_limit(200)?>" />
    <?php endwhile; endif; elseif(is_home()) : ?>
    <meta name="description" content="<?php bloginfo('description'); ?>" />
    <?php endif; ?>
    <meta name="description" content="<?php
     // if home page output blog name and description
     if (is_home()) { bloginfo('name'); echo " - "; bloginfo('description');}
     // if single page output either excerpt if available or post title
     elseif (is_single()) {
     $custommeta = get_post_meta($post->ID, "MetaDescription", true);
     // checks ot see if the custom field MetaDescription is not empty
     if ($custommeta !=='') {echo $custommeta;}
     // check if excerpt exists for the post and output it if it does
     elseif (!empty($post->post_excerpt)) {the_excerpt();}
     // if there's no custom field or excerpt output the post title
     else {single_post_title('', true);}
     }
     // if category page output the category description
     elseif (is_category()) {echo category_description();}
    
     // if it's any other page display this generic description
     else { echo 'Add your own generic site description here';}
     ?>"
    />

    Please help me with this problem.

  2. ChristiNi
    Member
    Posted 5 months ago #

  3. nikhu07
    Member
    Posted 5 months ago #

    I have tried all but that is not helping me..its still not showing the excerpt after sharing.

  4. ChristiNi
    Member
    Posted 5 months ago #

    Hi nikhu07,

    Each plugin may have a different way of handling the post excerpt and might also depend on your theme. Which plugin and theme are you using please?

    Thanks!

  5. nikhu07
    Member
    Posted 5 months ago #

    Thank you cristini, I have sorted it out..its the problem with my permalink on wordpress. now its catching my excerpt correctly.

  6. ChristiNi
    Member
    Posted 5 months ago #

    Fantastic nikhu07!

    Glad you were able to resolve this. If you have time, please let us know what the issue was with the permalinks and how you resolved it so anyone else having a similar issue can try that as well.

    Thanks!

  7. nikhu07
    Member
    Posted 5 months ago #

    Actually, I'm using custom permalink and in creating it, I forgot to place '/' That's why its not catching the excerpt. Now its fine.

  8. ChristiNi
    Member
    Posted 5 months ago #

    Thanks for the update nikhu07! Glad to hear everything is working fine now.

Reply

You must log in to post.

About this Topic