I have a one page app I’ve built with groups that display multiple data sets and I need to be able to more dynamically choose the SEO/FB image and description based on what is currently open.
For example, my app has Events, Clubs and Users who all have their own information and profile image. If a “Club” is being displayed and I share a link that will open my one page app directly to that Club’s page, I would like the SEO/FB Image and Description to be from that Club’s description and profile image. At the same time, if am sharing the profile of a User with a link that takes you directly to that User’s profile in my one page app, I would like that the SEO/FB Image and Description to show the User’s profile photo and description.
My problem arises in trying to pull the SEO/FB Image dynamically from these different objects in a one page app. I have tried the two following scenarios to no victory at this point:
-
Setting the SEO description and SEO image conditionally on the page. However, the option to set these conditionally is not present.
-
Creating a state that holds the image and another that holds the text I want to use for the SEO/FB Image and Description, but I cannot pull information from a state into the field “Image (For FB)” or “Description (for SEO / FB).” For example, if a Club’s profile is visible on my one page app and I share the URL, the Image (for FB) would be that Club’s profile image. But if I have a User’s profile visible instead and I share the URL, the Image (for FB) would be that USer’s profile image. But of course Club and User are two different data sets, so I cannot easily “do a search for” in the Image (for FB) field to set this as dynamically as I need.
Any help here? Am I completely misunderstanding these fields and how to interact with them?