I have set up a static page as a home page, however Yost SEO treats the paginated as a static page itself and does not display the correct canonical url.
So on - www.mywebsite.com/page/3/ the canonical is shown as www.mywebsite.com
The titles, meta description and keywords dont show the pagination.
The Rel Next / Previous links are not inserted in the pages as well.
A majority of theme developers are now using static pages as home pages for greater flexibility. Please do look into this,
If you don't give the real example URLs I can't do much for you, I'll need to do some checking. In general, this should work as long as these themes properly adapt the WP query, if they don't, there's no way we're going to support it.
Hi,
This is the url - http://luxurylaunches.com
and http://luxurylaunches.com/page/2/
Looks as though the paged query var isn't set to true...
We use normal and correct custom query. Here are two versions we tested, both returns the same result with the canonical URL.
Version 1:
if ( get_query_var('paged') ) $paged = get_query_var('paged');
if ( get_query_var('page') ) $paged = get_query_var('page');
$wp_query = new WP_Query(
array(
'posts_per_page' => $posts_to_show,
'paged' => $paged
)
);
Version 2:
$wp_query = new WP_Query(
array(
'posts_per_page' => $posts_to_show,
'paged' => get_query_var('page');
)
);
Hi,
so the big question is: WHEN do you run this query? In the template file?
Because that's too late.
On Wed, Dec 11, 2013 at 9:14 AM, morpheus83 [email protected]:
We use normal and correct custom query. Here are two versions we tested,
both returns the same result with the canonical URL.Version 1:
if ( get_query_var('paged') ) $paged = get_query_var('paged');
if ( get_query_var('page') ) $paged = get_query_var('page');$wp_query = new WP_Query(
array(
'posts_per_page' => $posts_to_show,
'paged' => $paged
)
);
Version 2:$wp_query = new WP_Query(
array(
'posts_per_page' => $posts_to_show,
'paged' => get_query_var('page');
)
);—
Reply to this email directly or view it on GitHubhttps://github.com/Yoast/wordpress-seo/issues/437#issuecomment-30301665
.
Hi Joost,
I'm one of the authors of the theme used by morpheus83. We would love to make our theme fully compatible with your plugin and make things right. The file where we use custom query is being added to a template with get_template_part. This is the query:
if ( get_query_var('paged') ) $paged = get_query_var('paged');
if ( get_query_var('page') ) $paged = get_query_var('page');
$args = array(
'post_type' => 'post',
'posts_per_page' => 5,
'paged' => $paged
);
$wp_query = new WP_Query( $args );
If you do that in the template part, so after get_header there's no way on earth you're going to get WP SEO to work as that has already created its output by then. You'd run into issues with several plugins doing it like that.
We have to run this query in a template, otherwise this part is becoming useless. Can you suggest something practical in order to make it work with canonical?
Well, you're basically running two queries now, because you're discarding the main query and rerunning your own. So it might become "useless", right now what you're doing is just very bad practice. I'm going to close this ticket as it's not our bug, it's an inherently wrong way of doing things on your end.
This query is in a custom template, which is being used as a static frontpage. Creating custom queries in custom templates never considered as a bad practice.
Creating custom queries halfway through the page load definitely is a bad practice. You should do that _before_ get_header is called.
—
Sent from Mailbox for iPhone
On Thu, Dec 12, 2013 at 1:31 PM, Vlad [email protected] wrote:
This query is in a custom template, which is being used as a static homepage. Creating custom queries in custom templates never considered as a bad practice.
Reply to this email directly or view it on GitHub:
https://github.com/Yoast/wordpress-seo/issues/437#issuecomment-30416755
I'd like to re-open this, as not only am I having the same issue, I would say this is a common way of creating a new query for a particular category or set of pages (within the template).
But further more, when placing the new query code before get_header(),this completely messes up the rest of the page.
But my issue is primarily that the ability to show pagination in the Yoast title info (where it uses %%page%%), does not work when performing new queries. I understand because get_header() has already been called. But surely, there must be a way to edit the header information when working with custom queries?
Or, can you give an idea of how you would perform a custom query, and have it work nicely with your plugin to show all correct title information?