XF 2.1 Adding og:type content "article" for thread_view template only.

JoyFreak

Well-known member
I've been trying to add

<xf:if is="$template == 'thread_view'">
<xf:set var="$meta"><meta property="og:type" content="article" /></xf:set>
</xf:if>

In "metadata_macros" template but it doesn't seem to work.
 
Looks like you can just pass "type" to metadata_macros

in thread_view, find

Code:
<xf:macro template="metadata_macros" name="metadata"
    arg-description="{$fpSnippet}"
    arg-shareUrl="{{ link('canonical:threads', $thread) }}"
    arg-canonicalUrl="{{ link('canonical:threads', $thread, {'page': $page}) }}" />

change to

Code:
<xf:macro template="metadata_macros" name="metadata"
    arg-description="{$fpSnippet}"
    arg-type="article"
    arg-shareUrl="{{ link('canonical:threads', $thread) }}"
    arg-canonicalUrl="{{ link('canonical:threads', $thread, {'page': $page}) }}" />

(untested)
 
Looks like you can just pass "type" to metadata_macros

in thread_view, find

Code:
<xf:macro template="metadata_macros" name="metadata"
    arg-description="{$fpSnippet}"
    arg-shareUrl="{{ link('canonical:threads', $thread) }}"
    arg-canonicalUrl="{{ link('canonical:threads', $thread, {'page': $page}) }}" />

change to

Code:
<xf:macro template="metadata_macros" name="metadata"
    arg-description="{$fpSnippet}"
    arg-type="article"
    arg-shareUrl="{{ link('canonical:threads', $thread) }}"
    arg-canonicalUrl="{{ link('canonical:threads', $thread, {'page': $page}) }}" />

(untested)
That worked, thank you!
 
  • Like
Reactions: arn
Back
Top Bottom