Define og:image in Category View

Phoca plugins - support for all Phoca plugins except Phoca Gallery plugins
diggles
Phoca Newbie
Phoca Newbie
Posts: 8
Joined: 02 Feb 2022, 20:07

Define og:image in Category View

Post by diggles »

Hello,

I've installed PhocaOpenGraph and it is working nicely for my articles. The process for choosing which image is displayed is a nice feature missing from other Open Graph plugins I've looked into.

My question is how do I define which image is chosen on Category View pages?

The instruction say this:

Phoca Open Graph uses the following process to display images in open graph meta tags (og:image):

1) Image which is set in parameters of the plugin (plugin parameters) will be set for the image meta tag on the website. In case, parameter Image (Parameter) Order is set to value First.

2) If no image is set in plugin parameter then the image set in category parameters (category of the article - this is valid only for category view).


#2 seems like what I am looking for, but when I define the image under the options tab in the edit category view it is not working. If there are no articles in the category view then no og:image tag is defined. If articles are displayed in the category view then it chooses the image from the first article in the list.

Please advise.

Thanks!
Warren
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 47810
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Define og:image in Category View

Post by Jan »

Hi, which version of Phoca Open Graph do you use now? I am testing it now and it works OK for me :idea:

Jan
If you find Phoca extensions useful, please support the project
diggles
Phoca Newbie
Phoca Newbie
Posts: 8
Joined: 02 Feb 2022, 20:07

Re: Define og:image in Category View

Post by diggles »

Hi Jan, I'm using 3.1.12. Just downloaded it today.

I'm using Joomlashack Article Layouts in my Category View, I'm going to try turning that off and see if it makes a difference.
diggles
Phoca Newbie
Phoca Newbie
Posts: 8
Joined: 02 Feb 2022, 20:07

Re: Define og:image in Category View

Post by diggles »

Hi Jan,

I figured out what is happening. When the category has articles then it works. If the category does not have any articles then it doesn't work. No OpenGraph tags are present when the category does not have any articles.

Is it possible for the OpenGraph tags to work when a category does not have articles?

Thanks!
Warren
diggles
Phoca Newbie
Phoca Newbie
Posts: 8
Joined: 02 Feb 2022, 20:07

Re: Define og:image in Category View

Post by diggles »

Hey Jan,

Just following up to see if it is possible for the OpenGraph tags to work when a category does not have articles.

Thanks!
Warren
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 47810
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Define og:image in Category View

Post by Jan »

Hi, yes, in category view, it just tries to search the first article for the items to be added to meta tags, so it needs to have some article included. If there is none, then the combination of content plugin and system plugin needs to be used. Content plugin only works in content (so in category view in first article e.g.). If there is no content article, there is even no active content plugin, so system plugin needs to be used.

Jan
If you find Phoca extensions useful, please support the project
diggles
Phoca Newbie
Phoca Newbie
Posts: 8
Joined: 02 Feb 2022, 20:07

Re: Define og:image in Category View

Post by diggles »

Hey Jan, thank you for the explanation. I've installed the latest version of the system plugin, but it is still not working when there is no article in the category. No OG data is being created at all.

Here are screenshots of my settings for category views. Please let me know if I need to do something different:

https://imgur.com/oXyeHHi
https://imgur.com/9lHxcbC
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 47810
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Define og:image in Category View

Post by Jan »

Hi, what is exactly the view you are using, when I test the category blog view:

Image

I get standard open graph meta tags there by system plugin.

Jan
If you find Phoca extensions useful, please support the project
diggles
Phoca Newbie
Phoca Newbie
Posts: 8
Joined: 02 Feb 2022, 20:07

Re: Define og:image in Category View

Post by diggles »

I'm using Category Blog view. After turning on Enable In Article Component (Featured View) then the OG tags showed up. It looks like all options have to be turned on for it to work, but it still doesn't choose the Category Image from the category settings. If I choose Find Image in Content then it picks one from the category description, if I set the Category Image in the plugin then it uses the one from the plugin.

So we've got this far, which is great, but I'm still missing the last piece of the puzzle. How to populate the og:image tag with the Category Image when the category does not include any articles.

Please help.

Thanks!
Warren
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 47810
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Define og:image in Category View

Post by Jan »

Hi, when I set the image for category, it is displayed in meta tags:

Image


Image

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