WordPress.org

Ready to get started?Download WordPress

Forums

Stop Permalinks (7 posts)

  1. thedooropens
    Member
    Posted 5 years ago #

    Hello,

    I have installed WP as a CMS. On the main page it shows last 5 full-posts as a news section. I don;t want any single posts pages or permalinks.

    Is there a way to do this? - I feel like I should be able to just turn them off... but it seems not

  2. msdana
    Member
    Posted 5 years ago #

    I believe for this you would need to remove the permalink reference in your index.php file.

    Example of default theme index.php file referencing the permalink:

    <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>

    Remove the anchor:

    <h2><?php the_title(); ?></h2>
  3. thedooropens
    Member
    Posted 5 years ago #

    Thanks - I did that already, but I can confirm single posts are still getting indexed. At least the H2 doesnt link to them anymore!

  4. msdana
    Member
    Posted 5 years ago #

    You mean you don't want the single pages to show up in search engines?

    You could add the following to your robots.txt file, if you have one (or create one):

    User-Agent: *
    Disallow: /FILE-NAME-HERE
  5. thedooropens
    Member
    Posted 5 years ago #

    I'm not too good on the php side of things. Will disallowing the single.php file block all single posts from getting indexed? That doesn't seem right to me!

  6. msdana
    Member
    Posted 5 years ago #

    Sorry if I wasn't clear. For each post, you need to disallow indexing.

    User-Agent: *
    Disallow: /your_post_file_name_here

    Perhaps someone else will come along and explain this better. I've never encountered this exact scenario before (i.e. not wanting single posts to show or be indexed).

  7. thedooropens
    Member
    Posted 5 years ago #

    Yes it seems to be hard to find a fix! Should be a button to turn them off, but I'm no programmer, maybe it's complex. Thanks for the suggestion.

Topic Closed

This topic has been closed to new replies.

About this Topic