Keyword

Custom Page Title

More
15 years 2 months ago #81478 by Ethan
Custom Page Title was created by Ethan
Is it possible with K2 to add a custom page title for SEO purposes?

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

More
15 years 2 months ago #81479 by Ethan
Replied by Ethan on topic Custom Page Title
Anyone? In case I wasn't clear, what I want is the ability to name my articles/posts one thing, but create an alternate "page title" that is SEO friendly. I've done this in the past with plugins that work with the core joomla articles, but I haven't found anything for K2. Please let me know if this exists. Thanks.

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

More
15 years 2 months ago #81480 by Björn Meyer
Replied by Björn Meyer on topic Custom Page Title
How can i add the name of the category to the page title ?

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

More
15 years 2 hours ago #81481 by Andrew Holden
Replied by Andrew Holden on topic Custom Page Title
There is a small solution possible. Try the 'Website Name' or another 'append-a-site-title' extension, so that you can append the title of your site to the existing page title.

It works with K2, too:
extensions.joomla.org/extensions/site-management/seo-a-metadata/3352

While this doesn't let you specify page titles per se, if your page titles and articles titles are so different that you need to specify, you probably aren't writing very good article titles anyway. (in most cases)

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

More
14 years 10 months ago #81482 by Davina
Replied by Davina on topic Custom Page Title
I've done so using the Custom Page Title plugin.

The plugin calls on the Key Reference field, which K2 doesn't include in the metadata options for its content items, but it's possible to add this by adding the following line of code to administrator/components/com_k2/models/item.xml:

<param name="keyref" type="text" size="25" default="" label="Key Reference" description="PARAMKEYREF" />

Since the K2 display doesn't call on all the same functions as displaying a Joomla article, I then copied the following code from components/com_content/views/article/view.html.php to components/com_k2/views/item/view.html.php:

* Handle display events
*/
$article->event = new stdClass();
$results = $dispatcher->trigger('onAfterDisplayTitle', array (&$article, &$params, $limitstart));
$article->event->afterDisplayTitle = trim(implode("\n", $results));

Hope this helps. Seems to be working for me anyway :)

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

More
14 years 9 months ago #81483 by John mcelborough
Replied by John mcelborough on topic Custom Page Title
Björn said:How can i add the name of the category to the page title ?


Hi, know this is old but in case anyone else is still looking to do this...

In components/ com_k2/views/item open item.html.php

Around line 236 replace...

//$params->set('page_title', $item->cleanTitle);

with

$params->set('page_title', $item->cleanTitle . ' - ' . $item->category->name);

Hope this helps

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

More
14 years 9 months ago #81484 by ak2user
Replied by ak2user on topic Custom Page Title
To John mcelborough:

I’m still tackling this issue, so thanks for the tip.

I need the title to be formatted as follows:

Parent category | Child category | Item

Perhaps you can help with that. With your previous suggestion I get:

Item - Child category

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

More
14 years 9 months ago #81485 by John mcelborough
Replied by John mcelborough on topic Custom Page Title
Hi

$params->set('page_title', $item->category->name . ' | ' . $item->cleanTitle);

Should give you:

Child category | Item

Sorry I'm not sure how to access the parent category but sure there is a way.

John

ak2user said:To John mcelborough:
I’m still tackling this issue, so thanks for the tip.

I need the title to be formatted as follows:

Parent category | Child category | Item

Perhaps you can help with that. With your previous suggestion I get:

Item - Child category

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

More
14 years 9 months ago #81486 by ak2user
Replied by ak2user on topic Custom Page Title
Thanks for your assistance. Now I need somehow to find out how to add the missing piece.

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

More
14 years 7 months ago #81487 by Paul
Replied by Paul on topic Custom Page Title
Cant seem to find this file in the link - com_k2/views/item open item.html.php

Can you confirm?

Cheers Pd



John mcelborough said:Björn said:How can i add the name of the category to the page title ?


Hi, know this is old but in case anyone else is still looking to do this...

In components/ com_k2/views/item open item.html.php

Around line 236 replace...

//$params->set('page_title', $item->cleanTitle);

with

$params->set('page_title', $item->cleanTitle . ' - ' . $item->category->name);

Hope this helps

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

More
14 years 7 months ago #81488 by ak2user
Replied by ak2user on topic Custom Page Title
It's view.html.php.

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

  • Daphne Christoforidou
  • Daphne Christoforidou's Avatar
  • Offline
  • New Member
More
14 years 2 months ago #81489 by Daphne Christoforidou
Replied by Daphne Christoforidou on topic Custom Page Title
Thanks for this fix John. The code

$params->set('page_title', $item->cleanTitle);

appears on line 233 and 236. Is it ok if we replace it in both cases or do we just have to replace line 236 and not line 233? I'm pasting the whole if clause here for anyone interested (it's after I applied the fix and as you can see I have commented out both line 233 and 236 and replaced them) :

 

//Set page title        $menus = &JSite::getMenu();        $menu = $menus->getActive();        if (is_object($menu) && isset($menu->query) && $menu->query == 'item' && isset($menu->query) && $menu->query == $item->id) {            $menu_params = new JParameter($menu->params);            if (!$menu_params->get('page_title')) {                //$params->set('page_title', $item->cleanTitle);                $params->set('page_title', $item->cleanTitle . ' | ' . $item->category->name);            }        } else {            //$params->set('page_title', $item->cleanTitle);            $params->set('page_title', $item->cleanTitle . ' | ' . $item->category->name);                    }        $document->setTitle($params->get('page_title'));

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

More
14 years 2 months ago #81490 by rexkramer
Replied by rexkramer on topic Custom Page Title
just found this older thread today, if someone is still interested in this topic ;-)

iJoomla SEO does support K2 and many other components.

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

More
14 years 1 month ago #81491 by matt haeck
Replied by matt haeck on topic Custom Page Title
This was giving me problems too - Once I got it figured out I made a quick post on my blog.  Hope it helps someone.

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

More
13 years 9 months ago #81492 by rosy jenith
Replied by rosy jenith on topic Custom Page Title
yet i have not tried, you must try once if possible then its would be great and let me know when done? Novoline

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

More
11 years 9 months ago #81493 by Dave W
Replied by Dave W on topic Re: Custom Page Title
Using file: view.html.php

Comment out or remove Line 248.
Replace with: $params->set('page_title', $item->cleanTitle . ' - ' . $item->category->name);



Line 248: // $params->set('page_title', $item->cleanTitle);
$params->set('page_title', $item->cleanTitle . ' - ' . $item->category->name);

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


Powered by Kunena Forum