Support » Fixing WordPress » Stop Permalinks
7 years, 10 months ago
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
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>
Thanks – I did that already, but I can confirm single posts are still getting indexed. At least the H2 doesnt link to them anymore!
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):
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!
Sorry if I wasn’t clear. For each post, you need to disallow indexing.
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).
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.