• We launched a car news site late last year – https://www.carsuk.net – and decided that it would be advantageous to have the category pages indexed. However, to avoid duplicate content we only allowed post titles. But it seems to make sense to have a custom excerpt for each post in the category pages to make use of the keywords and make the category pages more user-friendly.

    We have used All in One SEO from the beginning so all posts have unique Meta Descriptions. But we now want to make the Custom Excerpts the same as the Meta Descriptions so we can use them on the category pages.

    Short of copying and pasting every Meta Description to the Custom Excerpt field is there a way of doing this simply?

Viewing 6 replies - 1 through 6 (of 6 total)
  • You can modify your category.php file to display the post’s meta description instead of the_excerpt. That would be the fastest. All in One’s descriptions are stored as custom fields in the database.

    Thread Starter innovationcars

    (@innovationcars)

    That would be much easier! But php is not my strong point. What would be the correct format to replace ‘the_excerpt’?

    Hi

    <?php
    $metadesc = get_post_meta($post->ID, 'description', true);
    if ($metadesc) {
       echo $metadesc;
    } else {
       the_excerpt();
    }
    ?>

    This code displays the contents of the custom field named “description” if it exists and has a value in it (that is where All in One SEO stores the meta-descrip). Otherwise it displays the_excerpt.

    To have this appear on category pages, replace the_excerpt in the category.php template file with this code.

    You can make the same change on other templates too if desired – index.php will affect your main posts page.

    Thread Starter innovationcars

    (@innovationcars)

    Worked perfectly, and now all our category pages show the Meta Description as well as a thumbnail, which should make them more appealing to our readers and the search engines.

    Can’t thank you enough!

    Thread Starter innovationcars

    (@innovationcars)

    Steve – this is a damned cheek, but….

    AIOSEO changed how they store the Meta Description. It is now stored in a database as aioseop_description. Which screws up what you kindly did for us with the php to pull the meta description in as text on our post snippets. How do we go about incorporating this?

    Michael Torbert

    (@hallsofmontezuma)

    WordPress Virtuoso

    Modify the code to be aioseop_description instead of just description.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Copy Meta Description to Custom Excerpt’ is closed to new replies.