By Guest on Sunday, 20 November 2022
Replies 2
Likes 0
Views 647
Votes 0
Hi,
Because of duplicate title in SEO, I would like to cutom <title></title> in a detail event page.
Which file to edit ?
Template Geraint

Best regards
Michel
Create and override for defaultsetpagetitle.php

Copy the file components/com_jevents/views/default/helpers/defaultsetpagetitle.php to templates/YOURTEMPLATE/html/com_jevents/helpers/ and edit its content e.g. this would put the category name ahead of the event title


<?php

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/

use Joomla\CMS\Factory;

function DefaultSetPageTitle($view, $ev_title)
{

// Get menu item id

$newparams = Factory::getApplication('site')->getParams();
// Because the application sets a default page title,
// we need to get it from the menu item itself
$menu = Factory::getApplication()->getMenu()->getActive();

if (isset($menu->query["layout"]) && $menu->query["layout"] == "detail")
{
$newparams->def('page_heading', $newparams->get('page_title', $menu->title));
}
else
{
$event = $view->data['row'];

Factory::getDocument()->SetTitle( $event->getCategoryName() . " : " . $ev_title);
}
}
·
Tuesday, 22 November 2022 12:52
·
0 Likes
·
0 Votes
·
0 Comments
·
Sorry for the slow reply I had serious server issue I had to resolve as a matter of urgency

you can get the event id from

$id = $event->id();
·
Tuesday, 29 November 2022 12:04
·
0 Likes
·
0 Votes
·
0 Comments
·
View Full Post