Open Graph Image

Open Graph Image 2024-08-13

No permission to download

Old Nick

Well-known member
Old Nick submitted a new resource:

Open Graph Image - Open Graph image for social media

When creating a new post on social media, the Open Graph Image add-on will use the first uploaded attachment in your thread as the Open Graph image.


Read more about this resource...
 
Extremely useful, especially for forums that share URLs on social media platforms like Discord. I recently implemented this feature for the Resource Manager, allowing the resource icon to be used as the og:image.
 
@Old Nick - Is there a solution for articles too? It seems not to load the first image using the AMS from @Bob
I no longer use AMS, but I am surprised that this feature is not available, what does Bob say?
AMS Articles, Article Pages and Series have built in OG IMAGE support for sharing AMS Articles, Article Pages and Series on social media (and has had for over a decade). All of my addons have built in OG IMAGE support for sharing on social media.

With that said, that has nothing to do with sharing the associated discussion thread, which is what I think that @CedricV might be referring to in this case. Would be easy for Nick to add support for custom thread types tho ;)
 
Can this be modified to add the Twitter specific OG code too?
This is not the purpose of this add-on which only use the first uploaded attachment in your thread as the Open Graph image instead of the basic one defined in the ACP (editing the thread_view template). What you are talking about concerns the twitter metatags which must be added between the <head> tags of the PAGE_CONTAINER template.
 
This is not the purpose of this add-on which only use the first uploaded attachment in your thread as the Open Graph image instead of the basic one defined in the ACP (editing the thread_view template). What you are talking about concerns the twitter metatags which must be added between the <head> tags of the PAGE_CONTAINER template.

It would be great if it could do both. I've seen some Xenforo installs that do the Twitter OG tags, but it is not built into Xenforo and this could add it quite easily.
 
I understand but as I said it's not at all what this add-on is made for, especially since I will no longer maintain it, as I noted in the description, when that of JoyFreak will be new available. Maybe you can ask him to incorporate it into his?
 
I understand but as I said it's not at all what this add-on is made for, especially since I will no longer maintain it, as I noted in the description, when that of JoyFreak will be new available. Maybe you can ask him to incorporate it into his?

Will do once I hear from him. His site appears to be down/broken :(
 
What if to add another template modification for PAGE_CONTAINER with something like this?

Code:
<xf:if is="$thread.cover_image">
/twitter code
<xf:else/>
$0
</xf:if>

or $thread.cover_image doesn't exist on PAGE_CONTAINER level?
 
wait a second...
twitter:image is already there.

Code:
        <meta property="og:image" content="http://xf.localhost/attachments/maruv-jpeg.2/" />
        <meta property="twitter:image" content="http://xf.localhost/attachments/maruv-jpeg.2/" />
        <meta property="twitter:card" content="summary" />
 
I want to point out that this plugin isn't compatible with XenForo 2.2 because the concept of macro IDs was introduced in XenForo 2.3, and the add-on relies on macro IDs for template modifications.

Code:
<xf:macro id="metadata_macros::metadata"
    arg-description="{$fpSnippet}"
    arg-shareUrl="{{ link('canonical:threads', $thread) }}"
    arg-canonicalUrl="{{ link('canonical:threads', $thread, {'page': $page}) }}" />
 
Extremely useful, especially for forums that share URLs on social media platforms like Discord. I recently implemented this feature for the Resource Manager, allowing the resource icon to be used as the og:image.
I am looking for a Resource Manager icon

is there any update regarding this?
 
Back
Top Bottom