[JoyFreak] Set Open Graph Image

[JoyFreak] Set Open Graph Image

Thanks JoyFreak the code works well.
Also I let you know that your site (I try to register me there) doesn't send the activation email (to sign in) give it a look. ;)
Hi,

I tested it after receiving your email and yes, there was an issue but this was fixed. I did try email back but it said that your email doesn’t exist. So I tried to check by registering that email and it turns out it’s available to register. Please check your email and try again.
 
Yes it seems that the system found my username, but it hasn't my email in the profile because I didn't complete the registration with the activation email.
I send you my email in pm so you can try to fix it if possible.
Thanks Joy
 
Last edited:
Sent.
Another thing, have you some idea why testing the tool with an OG image tester, it says that there are 2 details not seen, these:

og:description missing
twitter:description missing

any idea what can be?
 
Test it, but furthermore it gives the same problem.

I have noted that in the file "metadata_macros"
is there this code:

Code:
<xf:macro name="metadata"
    arg-siteName=""
    arg-title=""
    arg-description=""
    arg-type=""
    arg-shareUrl=""
    arg-canonicalUrl=""
    arg-imageUrl=""
    arg-twitterCard="summary">

    <xf:if is="$siteName is not empty">
        <xf:macro name="site_name" arg-siteName="{$siteName}" />
    </xf:if>
    <xf:if is="$title is not empty">
        <xf:macro name="title" arg-title="{$title}" />
    </xf:if>
    <xf:if is="$description is not empty">
        <xf:macro name="description" arg-description="{$description}" />
    </xf:if>
    <xf:if is="$type is not empty">
        <xf:macro name="type" arg-type="{$type}" />
    </xf:if>
    <xf:if is="$shareUrl is not empty">
        <xf:macro name="share_url" arg-shareUrl="{$shareUrl}" />
    </xf:if>
    <xf:if is="$canonicalUrl is not empty">
        <xf:macro name="canonical_url" arg-canonicalUrl="{$canonicalUrl}" />
    </xf:if>
    <xf:if is="$imageUrl is not empty">
        <xf:macro name="image_url" arg-imageUrl="{$imageUrl}" arg-twitterCard="{$twitterCard}" />
    </xf:if>
</xf:macro>

<xf:macro name="site_name" arg-siteName="!" arg-output="{{ false }}">
    <xf:set var="$meta"><meta property="og:site_name" content="{$siteName|for_attr}" /></xf:set>
    <xf:macro name="output" arg-option="meta_site_name" arg-meta="{$meta}" arg-output="{$output}" />
</xf:macro>

<xf:macro name="title" arg-title="!" arg-output="{{ false }}">
    <xf:set var="$meta">
        <meta property="og:title" content="{$title|for_attr}" />
        <meta property="twitter:title" content="{{ snippet($title, 70)|for_attr }}" />
    </xf:set>
    <xf:macro name="output" arg-option="meta_title" arg-meta="{$meta}" arg-output="{$output}" />
</xf:macro>

<xf:macro name="description" arg-description="!" arg-output="{{ false }}">
    <xf:set var="$meta">
        <meta name="description" content="{{ snippet($description|strip_tags, 160)|for_attr }}" />
        <meta property="og:description" content="{{ snippet($description|strip_tags, 300)|for_attr }}" />
        <meta property="twitter:description" content="{{ snippet($description|strip_tags, 200)|for_attr }}" />
    </xf:set>
    <xf:macro name="output" arg-option="meta_description" arg-meta="{$meta}" arg-output="{$output}" />
</xf:macro>

<xf:macro name="type" arg-type="!" arg-output="{{ false }}">
    <xf:set var="$meta"><meta property="og:type" content="{$type}" /></xf:set>
    <xf:macro name="output" arg-option="meta_type" arg-meta="{$meta}" arg-output="{$output}" />
</xf:macro>

<xf:macro name="share_url" arg-shareUrl="!" arg-output="{{ false }}">
    <xf:set var="$meta"><meta property="og:url" content="{$shareUrl}" /></xf:set>
    <xf:macro name="output" arg-option="meta_share_url" arg-meta="{$meta}" arg-output="{$output}" />
</xf:macro>

<xf:macro name="canonical_url" arg-canonicalUrl="!" arg-output="{{ false }}">
    <xf:set var="$meta"><link rel="canonical" href="{$canonicalUrl}" /></xf:set>
    <xf:macro name="output" arg-option="meta_canonical_url" arg-meta="{$meta}" arg-output="{$output}" />
</xf:macro>

<xf:macro name="image_url" arg-imageUrl="!" arg-twitterCard="summary" arg-output="{{ false }}">
    <xf:set var="$meta">
        <meta property="og:image" content="{$imageUrl}" />
        <meta property="twitter:image" content="{$imageUrl}" />
        <meta property="twitter:card" content="{$twitterCard}" />
    </xf:set>
    <xf:macro name="output" arg-option="meta_image_url" arg-meta="{$meta}" arg-output="{$output}" />
</xf:macro>

<xf:macro name="output" arg-option="!" arg-meta="!" arg-output="{{ false }}">
    <xf:if is="$output">{$meta|raw}<xf:else /><xf:head option="{$option}">{$meta|raw}</xf:head></xf:if>
</xf:macro>

Maybe the problem should be here because I have found that:
og:description and twitter:description
are present only here, so maybe this is what is not making working good the things.
Any ideas?
 
Last edited:
Test it, but furthermore it gives the same problem.

I have noted that in the file "metadata_macros"
is there this code:

Code:
<xf:macro name="metadata"
    arg-siteName=""
    arg-title=""
    arg-description=""
    arg-type=""
    arg-shareUrl=""
    arg-canonicalUrl=""
    arg-imageUrl=""
    arg-twitterCard="summary">

    <xf:if is="$siteName is not empty">
        <xf:macro name="site_name" arg-siteName="{$siteName}" />
    </xf:if>
    <xf:if is="$title is not empty">
        <xf:macro name="title" arg-title="{$title}" />
    </xf:if>
    <xf:if is="$description is not empty">
        <xf:macro name="description" arg-description="{$description}" />
    </xf:if>
    <xf:if is="$type is not empty">
        <xf:macro name="type" arg-type="{$type}" />
    </xf:if>
    <xf:if is="$shareUrl is not empty">
        <xf:macro name="share_url" arg-shareUrl="{$shareUrl}" />
    </xf:if>
    <xf:if is="$canonicalUrl is not empty">
        <xf:macro name="canonical_url" arg-canonicalUrl="{$canonicalUrl}" />
    </xf:if>
    <xf:if is="$imageUrl is not empty">
        <xf:macro name="image_url" arg-imageUrl="{$imageUrl}" arg-twitterCard="{$twitterCard}" />
    </xf:if>
</xf:macro>

<xf:macro name="site_name" arg-siteName="!" arg-output="{{ false }}">
    <xf:set var="$meta"><meta property="og:site_name" content="{$siteName|for_attr}" /></xf:set>
    <xf:macro name="output" arg-option="meta_site_name" arg-meta="{$meta}" arg-output="{$output}" />
</xf:macro>

<xf:macro name="title" arg-title="!" arg-output="{{ false }}">
    <xf:set var="$meta">
        <meta property="og:title" content="{$title|for_attr}" />
        <meta property="twitter:title" content="{{ snippet($title, 70)|for_attr }}" />
    </xf:set>
    <xf:macro name="output" arg-option="meta_title" arg-meta="{$meta}" arg-output="{$output}" />
</xf:macro>

<xf:macro name="description" arg-description="!" arg-output="{{ false }}">
    <xf:set var="$meta">
        <meta name="description" content="{{ snippet($description|strip_tags, 160)|for_attr }}" />
        <meta property="og:description" content="{{ snippet($description|strip_tags, 300)|for_attr }}" />
        <meta property="twitter:description" content="{{ snippet($description|strip_tags, 200)|for_attr }}" />
    </xf:set>
    <xf:macro name="output" arg-option="meta_description" arg-meta="{$meta}" arg-output="{$output}" />
</xf:macro>

<xf:macro name="type" arg-type="!" arg-output="{{ false }}">
    <xf:set var="$meta"><meta property="og:type" content="{$type}" /></xf:set>
    <xf:macro name="output" arg-option="meta_type" arg-meta="{$meta}" arg-output="{$output}" />
</xf:macro>

<xf:macro name="share_url" arg-shareUrl="!" arg-output="{{ false }}">
    <xf:set var="$meta"><meta property="og:url" content="{$shareUrl}" /></xf:set>
    <xf:macro name="output" arg-option="meta_share_url" arg-meta="{$meta}" arg-output="{$output}" />
</xf:macro>

<xf:macro name="canonical_url" arg-canonicalUrl="!" arg-output="{{ false }}">
    <xf:set var="$meta"><link rel="canonical" href="{$canonicalUrl}" /></xf:set>
    <xf:macro name="output" arg-option="meta_canonical_url" arg-meta="{$meta}" arg-output="{$output}" />
</xf:macro>

<xf:macro name="image_url" arg-imageUrl="!" arg-twitterCard="summary" arg-output="{{ false }}">
    <xf:set var="$meta">
        <meta property="og:image" content="{$imageUrl}" />
        <meta property="twitter:image" content="{$imageUrl}" />
        <meta property="twitter:card" content="{$twitterCard}" />
    </xf:set>
    <xf:macro name="output" arg-option="meta_image_url" arg-meta="{$meta}" arg-output="{$output}" />
</xf:macro>

<xf:macro name="output" arg-option="!" arg-meta="!" arg-output="{{ false }}">
    <xf:if is="$output">{$meta|raw}<xf:else /><xf:head option="{$option}">{$meta|raw}</xf:head></xf:if>
</xf:macro>

Maybe the problem should be here because I have found that:
og:description and twitter:description
are present only here, so maybe this is what is not making working good the things.
Any ideas?
If this is in relation to the add-on then please post it in the correct thread so I am able to help.
 
Not I don't think is related to your addon.

But maybe the problem seems to be in that file in my installation. Because to the others it works.
 
Back
Top Bottom