×
K5.1.1 is released (10 Jun 2018)

The Kunena team is pleased to announce Kunena 5.1.1 [K 5.1.1].
Please read the blog post for information:

Solved How to change canonical link on forum main page?

More
2 years 10 months ago #1 by romagromov
Hi!

I checked my site for broken links and found duplicate links


/forum/category/list

and

/forum/

it is same pages.

This link displays in code:

<link href="/forum/category/list" rel="canonical" />

but forum main page link looks as /forum/

How I can change it?

Download Free Software for Windows absolutly free.

Please Log in or Create an account to join the conversation.

More
2 years 10 months ago #2 by romagromov
Any ideas?

Download Free Software for Windows absolutly free.

Please Log in or Create an account to join the conversation.

More
More
2 years 9 months ago #4 by romagromov
I can't understand...

I need to fix BUG. Not to remove canonical.


I need on forum main page canonical displays as

<link href="/forum/" rel="canonical" />

instead

<link href="/forum/category/list" rel="canonical" />

Download Free Software for Windows absolutly free.

Please Log in or Create an account to join the conversation.

More
2 years 9 months ago - 2 years 9 months ago #5 by 810
mhh I found a way, but its showed:

<link href="/master/forum" rel="canonical" />
<link href="/master/forum/recent" rel="canonical" />

Is that ok?
components\com_kunena\controllers\home.php line 28
$doc = JFactory::getDocument();
$doc->addHeadLink( 'forum', 'canonical', 'rel', '' );
Last edit: 2 years 9 months ago by 810.

Please Log in or Create an account to join the conversation.

More
2 years 9 months ago #6 by romagromov
But 2 canonical links is impossible...

Download Free Software for Windows absolutly free.

Please Log in or Create an account to join the conversation.

More
2 years 9 months ago #7 by romagromov
Still have problem...

2 canonical links on page is inadmissible

<link href="/master/forum" rel="canonical" />
<link href="/master/forum/recent" rel="canonical" />


Download Free Software for Windows absolutly free.

Please Log in or Create an account to join the conversation.

More
2 years 7 months ago - 2 years 7 months ago #8 by romagromov
Ok, I made little hack for file

/libraries/kunena/view.php

1. Find code (line 105)
if (JFactory::getApplication()->isAdmin())

add above this code
$juricurrent = JURI::current();

Then, after code
{
			$this->displayLayout();
		}

add

elseif ($juricurrent == 'https://yoursite/forum'){
 
			$this->document->addHeadLink( $juricurrent, 'canonical', 'rel', '' );
			include JPATH_SITE .'/'. $this->ktemplate->getFile('html/display.php');
 
		}

where https://yoursite/forum is your url on forum main page

So, public function displayAll code should looks like:

public function displayAll()
	{
		if ($this->inLayout)
		{
			throw new LogicException(sprintf('HMVC template should not call %s::%s()', __CLASS__, __FUNCTION__));
		}
 
		if ($this->me->isAdmin())
		{
			if ($this->config->board_offline)
			{
				$this->app->enqueueMessage ( JText::_('COM_KUNENA_FORUM_IS_OFFLINE'), 'notice');
			}
 
			if ($this->config->debug)
			{
				$this->app->enqueueMessage ( JText::_('COM_KUNENA_WARNING_DEBUG'), 'notice');
			}
		}
		if ($this->me->isBanned())
		{
			$banned = KunenaUserBan::getInstanceByUserid($this->me->userid, true);
 
			if (!$banned->isLifetime())
			{
				$this->app->enqueueMessage ( JText::sprintf ( 'COM_KUNENA_POST_ERROR_USER_BANNED_NOACCESS_EXPIRY', KunenaDate::getInstance($banned->expiration)->toKunena('date_today')), 'notice');
			}
			else
			{
				$this->app->enqueueMessage ( JText::_ ( 'COM_KUNENA_POST_ERROR_USER_BANNED_NOACCESS' ), 'notice');
			}
		}
 
		$this->state = $this->get ( 'State' );
		$this->ktemplate->initialize();
 
		$juricurrent = JURI::current();
		if (JFactory::getApplication()->isAdmin())
		{
			$this->displayLayout();
		}
		elseif ($juricurrent == 'https://yoursite/forum'){
 
			$this->document->addHeadLink( $juricurrent, 'canonical', 'rel', '' );
			include JPATH_SITE .'/'. $this->ktemplate->getFile('html/display.php');
		}
		else
		{
			$this->document->addHeadLink( KunenaRoute::_(), 'canonical', 'rel', '' );
			include JPATH_SITE .'/'. $this->ktemplate->getFile('html/display.php');
 
			if ($this->config->get('credits', 1))
			{
				$this->poweredBy();
			}
		}
	}

Of course, this hack will lost after update.

I can't understand, why Kunena developers can't fix this major BUG.

Download Free Software for Windows absolutly free.
Last edit: 2 years 7 months ago by romagromov.

Please Log in or Create an account to join the conversation.

More
2 years 7 months ago #9 by 810
The following user(s) said Thank You: romagromov

Please Log in or Create an account to join the conversation.

  • Not Allowed: to create new topic.
  • Not Allowed: to reply.
  • Not Allowed: to add attachements.
  • Not Allowed: to edit your message.
Time to create page: 0.110 seconds