Tagged: pagination
-
AuthorPosts
-
July 13, 2015 at 10:42 am #472221
Hello,
I have been reading that google’s preferred method of pagination should include a ‘view all’ option in the pagination structure. So, my first question is can a view all link be added to the pagination?
“Google’s preferred first choice for handling most pagination issues is to create a separate “View-All” page apart from the paginated series and include all of the items within this single page. Once you’ve created the View-All page, you can then place a rel=”canonical” tag within the <head> section of each paginated component page, pointing to the View-All Page. (e.g. <link rel=”canonical” href=”http://www.site.com/view-all-page”/>). This will essentially tell Google to treat each specific page in a paginated series as a segment of the View-All page and queries will return the View-All page as opposed to a relevant segment page of the pagination chain.”
Second question relates to the above. How can a rel attribute be added interdependently to specific portfolio category pages?
Thanks – Andrew
July 14, 2015 at 10:17 am #472953Hey Andrew!
You don’t necessarily need to add a View All link to the pagination links, what you need to do is:
1. Create a View All page showing all items at once.
2. Place the rell tag on all paginated screens, you can use the following code (functions.php) for that:add_action('wp_head', function() { if ( is_paged() ){ ?> <link rel=”canonical” href=”http://www.site.com/view-all-page”/> <?php } });
Regards,
JosueJuly 14, 2015 at 11:08 am #472981Thanks for the information Josue,
This would cause a problem though because I have 4 portfolio categories (which are different items) so I would need to add a view all
page for each portfolio category – how would I do that?Also, in your code above, how would the viewer know about the ‘view all’ page if it is not listed within the pagination?
Thanks again,
Andrew
July 14, 2015 at 11:10 am #472985Below is the page that launches the portfolio categories
July 14, 2015 at 11:20 am #472993That’s up to you, you can point the link tag to the category index, or that page you’ve just linked or to a new page, use the following codes to add the tags for each one (IDs are already set, just change the
href
in each one):<?php add_action('wp_head', function() { if ( is_page (3841) ){ // http://www.emailweddingcard.com/email-wedding-card-designs/box-style-email-wedding-card-design/ echo '<link rel="canonical" href="http://www.site.com/view-all-page"/>'; } elseif ( is_page (3352) ){ // http://www.emailweddingcard.com/email-wedding-card-designs/royal-scroll-email-wedding-cards/ echo '<link rel="canonical" href="http://www.site.com/view-all-page"/>'; } elseif ( is_page (2957) ){ // http://www.emailweddingcard.com/email-wedding-card-designs/pocket-fold-email-wedding-cards/ echo '<link rel="canonical" href="http://www.site.com/view-all-page"/>'; } elseif ( is_page (3527) ){ // http://www.emailweddingcard.com/email-wedding-card-designs/letter-style-email-wedding-cards/ echo '<link rel="canonical" href="http://www.site.com/view-all-page"/>'; }else{ } });
Regarding a view all link, although you could add it with some custom coding it’s not necessary per your initial request as this tags are meant to be read by Google robots and not the user.
Cheers!
JosueJuly 14, 2015 at 11:35 am #473004Thanks Josue, I’ll give it a go!
Andrew
July 14, 2015 at 11:38 am #473008Just to clarify
July 14, 2015 at 11:44 am #473018Yeah, having a look at your actual set-up
is_paged
would not be ideal, try with the last block of code.Regards,
JosueJuly 14, 2015 at 11:48 am #473024So just this code?
July 14, 2015 at 11:56 am #473039Correct.
July 14, 2015 at 11:58 am #473041Thanks again.
July 14, 2015 at 12:02 pm #473048You are welcome, glad to help :)
Regards,
JosueJuly 14, 2015 at 12:29 pm #473086Hello
When I add the code exactly as seen in the box below it breaks the site (white screen) – can you give the code a quick check please. I have tried adding it to the top and bottom of the functions.php file.
July 14, 2015 at 1:05 pm #473116add_action('wp_head', function() { if ( is_page (3841) ){ // http://www.emailweddingcard.com/email-wedding-card-designs/box-style-email-wedding-card-design/ echo '<link rel="canonical" href="http://www.emailweddingcard.com/email-wedding-card-designs/all-box-style-email-wedding-card-templates/"/>'; } elseif ( is_page (3352) ){ // http://www.emailweddingcard.com/email-wedding-card-designs/royal-scroll-email-wedding-cards/ echo '<link rel="canonical" href="http://www.emailweddingcard.com/email-wedding-card-designs/all-scroll-style-email-wedding-card-templates/"/>'; } elseif ( is_page (2957) ){ // http://www.emailweddingcard.com/email-wedding-card-designs/pocket-fold-email-wedding-cards/ echo '<link rel="canonical" href="http://www.emailweddingcard.com/email-wedding-card-designs/all-pocket-fold-email-wedding-card-template-designs/"/>'; } elseif ( is_page (3527) ){ // http://www.emailweddingcard.com/email-wedding-card-designs/letter-style-email-wedding-cards/ echo '<link rel="canonical" href="http://www.emailweddingcard.com/email-wedding-card-designs/all-letter-style-email-wedding-card-templates/"/>'; }else{ } });
If you are putting it at the end of functions.php put it without the <?php, also copy it from the forum reply and not from the mail notification.
July 14, 2015 at 1:26 pm #473129Thanks, that worked however something strange. In the code below (I didn’t see this before) there is already a rel=”canonical” for the portfolio category, not the ‘all portfolio items’ I just created. Any idea why or how this is there? You can view the one I didn’t put there at the top of the code below and the new one at the bottom. Presumably it’s not wise to have 2?
July 14, 2015 at 1:30 pm #473133Hello,
Are you using any SEO plugins in addition to that? have you tried disabling all third-party plugins to see if what happens?
Regards,
JosueJuly 14, 2015 at 1:44 pm #473150No seo plugins.
July 14, 2015 at 1:49 pm #473155Just turned off all plugins and still see it.
July 14, 2015 at 1:57 pm #473162It seems that WP now adds canonical links to all pages – http://pixelpunk.co.uk/2010/01/disable-wordpress-built-in-canonical-url/
Which can be turned off. I am going to test it to see if the code you provided is removed when I turn off the default wordpress canonical but should your example use:rel=”canonical”
or
rel=’canonical’
July 14, 2015 at 1:59 pm #473164If you are referring to the quotes, it doesn’t really matter.
July 14, 2015 at 2:02 pm #473167Ok, that seems to work. In your opinion is it wise to turn off the global canonical parameter?
Thanks – Andrew
July 14, 2015 at 2:32 pm #473185You could change the code so the canonical removal only occurs on those pages:
add_action('wp_head', function() { if ( is_page (3841) ){ // http://www.emailweddingcard.com/email-wedding-card-designs/box-style-email-wedding-card-design/ echo '<link rel="canonical" href="http://www.emailweddingcard.com/email-wedding-card-designs/all-box-style-email-wedding-card-templates/"/>'; } elseif ( is_page (3352) ){ // http://www.emailweddingcard.com/email-wedding-card-designs/royal-scroll-email-wedding-cards/ echo '<link rel="canonical" href="http://www.emailweddingcard.com/email-wedding-card-designs/all-scroll-style-email-wedding-card-templates/"/>'; } elseif ( is_page (2957) ){ // http://www.emailweddingcard.com/email-wedding-card-designs/pocket-fold-email-wedding-cards/ echo '<link rel="canonical" href="http://www.emailweddingcard.com/email-wedding-card-designs/all-pocket-fold-email-wedding-card-template-designs/"/>'; } elseif ( is_page (3527) ){ // http://www.emailweddingcard.com/email-wedding-card-designs/letter-style-email-wedding-cards/ echo '<link rel="canonical" href="http://www.emailweddingcard.com/email-wedding-card-designs/all-letter-style-email-wedding-card-templates/"/>'; } elseif ( is_page( array( 3831, 3352, 2957, 3527 ) ) ){ remove_action('wp_head', 'rel_canonical'); // this runs on those pages only } else {} }, 1);
Best regards,
JosueJuly 14, 2015 at 2:49 pm #473200Thanks for that Josue,
Once again you’ve been a great help.
Andrew
July 14, 2015 at 2:54 pm #473204Can I just double check the code with you because it still shows 2 (at the top and the bottom)
July 14, 2015 at 8:33 pm #473421Hi,
Can you please create us a WordPress administrator account? post it here as a private reply.
Regards,
JosueJuly 14, 2015 at 10:15 pm #473457Sure, its listed below.
July 16, 2015 at 11:56 am #474189Should work now, check the source code.
Best regards,
JosueJuly 16, 2015 at 12:29 pm #474214Thanks Josue, it is ok now. Just so I know was it just something you changed in the functions.php file, if so I can just copy and save it.
July 16, 2015 at 11:07 pm #474588Yes, you can check the code at the end of your theme functions.php.
Best regards,
Josue -
AuthorPosts
- You must be logged in to reply to this topic.