- Posts: 1
COMMUNITY FORUM
Duplicate Title Problem for navigation pages of K2
- Jasim Mushtaq
- Topic Author
- Offline
- New Member
Less
More
6 years 1 week ago #170227
by Jasim Mushtaq
Duplicate Title Problem for navigation pages of K2 was created by Jasim Mushtaq
I am having a problem for which image is attached. The problem is of duplicate pages title and description on my navigation pages of blog. The link of both is attached
www.vjcyber.com/blog?limit=5&start=45
www.vjcyber.com/blog?start=45
The component is K2!
If you see the page source these both are marked as canonical but google is indexing it!
The image of webmaster is attached!
How to get rid of this problem please help, as i am not able to solve this problem after even long tries!
Will be thanksfull!
www.vjcyber.com/blog?limit=5&start=45
www.vjcyber.com/blog?start=45
The component is K2!
If you see the page source these both are marked as canonical but google is indexing it!
The image of webmaster is attached!
How to get rid of this problem please help, as i am not able to solve this problem after even long tries!
Will be thanksfull!
Please Log in or Create an account to join the conversation.
- JoomlaWorks
- Offline
- Admin
Less
More
- Posts: 6218
6 years 1 week ago #170250
by JoomlaWorks
Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by JoomlaWorks on topic Duplicate Title Problem for navigation pages of K2
These are the same pages as you can see. The extra ?limit parameter is added to indicate 5 items per page. But it's not really needed. See for example the pagination at: getk2.org/blog
Any chance some other plugin is enforcing this variable?
Any chance some other plugin is enforcing this variable?
Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- JoomlaWorks
- Offline
- Admin
Less
More
- Posts: 6218
6 years 1 week ago #170308
by JoomlaWorks
Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by JoomlaWorks on topic Duplicate Title Problem for navigation pages of K2
OK, apparently this is some sort of bug or intended behaviour on Joomla's part. The pagination is created by appending ?start=X to the system cached URL. To fix this, you can simply override your template's pagination. I'm gonna show you what we use and then you can adjust yours accordingly.
This is our /templates/TEMPLATE_NAME/html/pagination.php file. If you don't have one in your template's /html folder, simply create a pagination.php file and copy the contents below
This is our /templates/TEMPLATE_NAME/html/pagination.php file. If you don't have one in your template's /html folder, simply create a pagination.php file and copy the contents below
<?php
// no direct access
defined('_JEXEC') or die('Restricted access');
function pagination_item_active(&$item)
{
// Filter the URL to only allow for "?start=" [start]
$page = $item->link;
if (strpos($page, '?')!==false) {
$query = explode('?', $page);
$query = $query[1];
if ($query != '') {
if (strpos($query, '&')!==false) {
$page = str_replace('?'.$query, '', $page);
$params = explode('&', $query);
foreach ($params as $param) {
if (substr($param, 0, 6) == 'start=') {
$page = $page.'?'.$param;
}
}
}
}
}
$item->link = $page;
// Filter the URL to only allow for "?start=" [finish]
return '<a href="'.$item->link.'" title="'.$item->text.'"><span>'.$item->text.'</span></a>';
}
function pagination_item_inactive(&$item)
{
return '<span class="active"><span>'.$item->text.'</span></span>';
}
function pagination_list_render($list)
{
$pages = '';
foreach ($list['pages'] as $page) {
$pages .= $page['data'];
}
return '
<div class="pagination">
<span class="start-button">'.$list['start']['data'].'</span>
<span class="prev-button">'.$list['previous']['data'].'</span>
<span class="pages">'.$pages.'</span>
<span class="next-button">'.$list['next']['data'].'</span>
<span class="end-button">'.$list['end']['data'].'</span>
<div class="clr"></div>
</div>
';
}
function pagination_list_footer($list)
{
return '
<div class="list-footer">
<div class="limit">
'.JText::_('Display Num').$list['limitfield'].'
</div>
'.$list['pageslinks'].'
<div class="counter">
'.$list['pagescounter'].'
</div>
<input type="hidden" name="limitstart" value="'.$list['limitstart'].'" />
</div>
';
}
Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.