Page 1 of 1

Tag tittle

Posted: 13 Oct 2021, 05:40
by ierofant
You can tag to make headlines and meta description? Maybe you can add a tag header ?
Sorry for my english!

Re: Tag tittle

Posted: 19 Oct 2021, 22:37
by Jan
Hi, what do you exactly mean with "add a tag header"?

Jan

Re: Tag tittle

Posted: 21 Oct 2021, 12:38
by ierofant
Jan wrote: 19 Oct 2021, 22:37 Hi, what do you exactly mean with "add a tag header"?

Jan
Hi

Code: Select all

tag?tagid=1 - car
Title (car), h1 (car)...

Re: Tag tittle

Posted: 25 Oct 2021, 00:43
by Jan
Hi, for now there is no such option, so this needs to be customized directly in the view :idea:

components/com_phocagallery/views/category/tmpl/default.php

line 54+

Jan

Re: Tag tittle

Posted: 28 Nov 2023, 21:30
by ierofant
Hi, i can't understand it in any way, it doesn't work out

Code: Select all

echo '<div class="page-header"><h1>'. $this->escape($heading);

if (isset($tagId) && $tagId != '') {
    echo ' - ' . $this->escape($tagId);
}
echo '</h1></div>';
	} 

Re: Tag tittle

Posted: 30 Nov 2023, 02:12
by Jan
Hi, what exactly don't you understand?

Jan

Re: Tag tittle

Posted: 30 Nov 2023, 20:19
by ierofant
Hi, I was wondering if there's a way to display both the title and h1 for tags. In our previous conversation, we discussed using tags in the URL (tag?tagid=1 - car). Is there a way to incorporate this into the title and h1 for better SEO? I'm having some difficulty understanding the customization process you mentioned in components/com_phocagallery/views/category/tmpl/default.php, starting from line 54+. Could you provide more guidance or perhaps an example? Thanks!

Re: Tag tittle

Posted: 03 Dec 2023, 01:00
by Jan
Hi, I didn't do such customization yet, so unfortunately, I cannot add any clude advice how to do this.

- first you will get information about tag ID
- then you ask database for the title of such tag
- then this title will be displayed in header tag.

So this is not only about displaying the tag title but you need to get the title too.


e.g., getting info about tag id:

Code: Select all

$query = 'SELECT a.id, a.title, a.link_ext, a.link_cat'
		.' FROM #__phocagallery_tags AS a'
		.' WHERE a.id = '.(int)$tagId
		.' ORDER BY a.id';
In your code you are using variable which does not exist: $tagId, there is $this->tagId

Jan

Re: Tag tittle

Posted: 03 Dec 2023, 13:57
by ierofant

Code: Select all

echo '<div class="page-header"><h1>'. $this->escape($heading);

$pageTitle = $heading;

if (isset($this->tagId) && $this->tagId != '') {

    $db = JFactory::getDbo();

    $tagQuery = $db->getQuery(true)
        ->select($db->quoteName('title'))
        ->from($db->quoteName('#__phocagallery_tags'))
        ->where($db->quoteName('id') . ' = ' . (int)$this->tagId);

    $db->setQuery($tagQuery);
    $tagTitle = $db->loadResult();

    if ($tagTitle) {
        echo ' - ' . $this->escape($tagTitle);

        $pageTitle = $this->escape($tagTitle) . ' - ' . $pageTitle;
    }
}

echo '</h1></div>';

JFactory::getDocument()->setTitle($pageTitle);
Thanks for the tip, it's a working option!

Re: Tag tittle

Posted: 07 Dec 2023, 19:27
by Jan
Ok, thank you for the info.

Jan