0

So I set my home page to "Your latest posts", and included this bit of code to get the info from a pre-defined page so that I can edit my home page, and get access to a "recent posts" grid with pagination at the same time. In addition, I can edit this post via the Gutenberg Block editor with this method.

I'd like to eliminate the possibility of a "duplicate content" flag on my content, so should I no-index the source page?

<picture class="featured-image block  pos-rel">
    <div class="t-con flex row pos-abs">
        <h1  class="post-title f-center" title="<?php echo get_the_title( $ID=2 ); ?>"><?php echo get_the_title( $ID=2 ); ?></h1> <!--Edit these values to adjust page being shown.-->
    </div>
    <?php the_post_thumbnail( 'full', array( 
        'class' => 'featured'
    )); ?>
</picture>
<?php get_search_form(); ?>
<section class="main bg-darkpurple">
<?php 
    $id=2; 
    $post = get_post($id); 
    $content = apply_filters('the_content', $post->post_content); 
    echo $content;  
?>

Also, I'm aware that the the_title_attribute() should be used in place of echo get_the_title($ID=2) however, when I use that, even with $ID declared, It outputs the attribute of the latest post instead.

Thanks for the insight!

0

Rather than just no-indexing the Page, 301 redirect it. This can be done either by server config (.htaccess, NGINX rules, etc.) or using a plugin. That way no one can actually get to the Page all on its own - it only exists on the front page.

| improve this answer | |
  • That is a much better option. I was thinking the sitemap that is autogenerated by yoast might cause some issues, but I suppose not. Thanks! – Devon Jan 17 at 21:17
  • It wouldn't hurt to also exclude it from the Yoast sitemap, which your original noindex plan should also accomplish. Removing all traces of it as a separate page is ideal. – WebElaine Jan 17 at 21:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.