Forum
Creating link rel="prev" link rel="next" in the area using 'product_prev...
I have successfully added the prev next links to a List/Detail set up. For SEO reasons would like to add rel="prev" link rel="next" in <head> area. ie
<link rel="next" href="https://www.domain.co.uk/subfolder/page3"/>
<link rel="prev" href="https://www.domain.co.uk.gridhosted.co.uk/subfolder/page1" />
Have created a template variant of prev next and added same code from body area into the head
Template canon.html
<perch:if exists="is_prev">
<link rel="prev" href="/corporate-video/portfolio-detail.php?s=<perch:content id="slug" type="slug" />" />
<perch:else />
<link rel="next" href="/portfolio-detail.php?s=<perch:content id="slug" type="slug" />"/>
</perch:if>
Head Code
<?php
perch_content_custom('CorporateVideo', array(
'page' => '/corporate-video/index.php',
'template' => 'canon.html',
'filter' => '_order',
'match' => 'gt',
'value' => $result[0]['_sortvalue'],
'sort' => '_order',
'sort-order' => 'ASC',
'count' => 1,
));
?>
<?php
PerchSystem::set_var('is_prev', true);
perch_content_custom('CorporateVideo', array(
'page' => '/corporate-video/index.php',
'template' => 'canon.html',
'filter' => '_order',
'match' => 'lt',
'value' => $result[0]['_sortvalue'],
'sort' => '_order',
'sort-order' => 'DESC',
'count' => 1,
));
?>
It works BUT outputs the SAME first and last page (from the list of pages) on EVERY detail page.
I would be grateful for any help with this. Many thanks
Where is
$result
getting set?Hi Drew
It is in the <body> area where it is working successfully for the Next / Previous visible on the page.
I can see if I put the following into the head area - my SEO <link rel="next" <link rel="prev" does work - but obviously displays the content so no good....but hints at a solution.
Remove
echo $result['html'];
Ah of course! Many thanks for your help with this, very important to get this right for me. SEO 'audit' pushing my Perch knowledge...which is good for me, although may generate odd question for you.