Open Graph System Plugin doesn't output any tags for Featured Articles menu items

Phoca plugins - support for all Phoca plugins except Phoca Gallery plugins
User avatar
Abatap
Phoca Member
Phoca Member
Posts: 13
Joined: 15 Jan 2019, 18:37

Re: Open Graph System Plugin doesn't output any tags for Featured Articles menu items

Post by Abatap »

You did understand this correctly. My main question here is why it doesn't use fallback values for OG values the same way it does for empty Category Blog pages (as you can see if you click the "Blog" menu item)? There is simply no expected consistency in how plugin works with empty views of different kinds it serves.
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48386
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Open Graph System Plugin doesn't output any tags for Featured Articles menu items

Post by Jan »

Hi, now I understand. The difference between blog and featured is, when the blog is displayed and there is no article, the plugin tries to find information from the category. This is not done by featured view.

Because if there is no article in blog, the site still renders the information about the category. But this is not the same for featured view. Featured view doesn't get any information about the category when there is no featured article listed.

Jan
If you find Phoca extensions useful, please support the project
User avatar
Abatap
Phoca Member
Phoca Member
Posts: 13
Joined: 15 Jan 2019, 18:37

Re: Open Graph System Plugin doesn't output any tags for Featured Articles menu items

Post by Abatap »

So there is no way to output OG tags in such cases? Of course I can publish a CSS-hidden Newsflash module with a single empty article in it just to trigger the OG output but it still seems a little too much to workaround something I thought was a simple bug.
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48386
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Open Graph System Plugin doesn't output any tags for Featured Articles menu items

Post by Jan »

Hi, you can copy this code:

Code: Select all

if (isset($row->catid) && (int)$row->catid > 0) {
				$db = JFactory::getDBO();
				$query = ' SELECT c.metadesc, c.metakey, c.params, c.title FROM #__categories AS c'
			    .' WHERE c.id = '.(int) $row->catid . ' LIMIT 1';
				$db->setQuery($query);
				$cItem = $db->loadObjectList();
				
				if (!empty($cItem[0]->params)) {
					$registry = new JRegistry;
					$registry->loadString($cItem[0]->params);
					$pC = $registry->toArray();
					if (isset($pC['image']) && $pC['image'] != '') {
						$thisImg =  $pC['image'];
					}
					
				}
				
				if (isset($cItem[0]->metadesc) && $cItem[0]->metadesc != '') {
					//$row->metadesc 	= $cItem[0]->metadesc; We cannot influence global variable
					$thisDesc		= $cItem[0]->metadesc;
				}
				if (isset($cItem[0]->title) && $cItem[0]->title != '') {
					//$row->title 	= $cItem[0]->title; We cannot influence global variable
					$thisTitle		= $cItem[0]->title;
				}
				if (isset($cItem[0]->metakey) && $cItem[0]->metakey != '') {
					//$row->title 	= $cItem[0]->title; We cannot influence global variable
					$thisKey		= $cItem[0]->metakey;
				}
			}
line cca 150 and add it to block on line cca 147 but the problem still remains. If there is no article marked as featured, you don't get any information about the cateogry from Joomla! system, so the condition will be ignored.

Jan
If you find Phoca extensions useful, please support the project
User avatar
Abatap
Phoca Member
Phoca Member
Posts: 13
Joined: 15 Jan 2019, 18:37

Re: Open Graph System Plugin doesn't output any tags for Featured Articles menu items

Post by Abatap »

Thanks for your answer but I'm afraid I'm not going to bother with editing plugin files as these changes will be lost on update and I can come up with a more reliable solution similar to the one described in my previous post. Anyway, thanks for all the tech support, I guess this topic can be closed now.
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48386
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Open Graph System Plugin doesn't output any tags for Featured Articles menu items

Post by Jan »

Ok
If you find Phoca extensions useful, please support the project
Post Reply