As per title, fetch/set LD Structured Data via getLdStructuredData() function in the Event Entity and Bet Entity.
Sportsbook now uses the same standard as Thread Types and XFMG use to fetch/set LD Structured Data for both Events and Bets
Here is an example (this is what the template code in the xa_sb_event_view template looks like now. It uses extensions and a function call.
Quick example on how to use template extensions (use the XenForo Developers Forum if you want to learn more about template extensions in general). This example is used in the thread_view_type_question template to pass in some additional structured data params to the thread_view template which uses the same type of template code shown above...
And this is in the thread_view template. The above extension is passing data into the structured_data_extra_params extension, which will then be passed into the getLdStructuredData function in the Thread Entity.
Sportsbook now uses the same standard as Thread Types and XFMG use to fetch/set LD Structured Data for both Events and Bets
Here is an example (this is what the template code in the xa_sb_event_view template looks like now. It uses extensions and a function call.
HTML:
<xf:page option="ldJsonHtml">
<xf:extension name="structured_data_extra_params" value="{{ [] }}" />
<xf:extension name="structured_data">
<xf:set var="$ldJson"
value="{{ $event.getLdStructuredData($page, extension_value('structured_data_extra_params')) }}"
/>
<xf:if is="$ldJson">
<script type="application/ld+json">
{$ldJson|json(true)|raw}
</script>
</xf:if>
</xf:extension>
</xf:page>
Quick example on how to use template extensions (use the XenForo Developers Forum if you want to learn more about template extensions in general). This example is used in the thread_view_type_question template to pass in some additional structured data params to the thread_view template which uses the same type of template code shown above...
HTML:
<xf:extends template="thread_view" />
<xf:extension name="structured_data_extra_params" value="{{ {
'highlightedPosts': $highlightedPosts,
'suggestedSolutions': $suggestedSolutions
} }}" />
And this is in the thread_view template. The above extension is passing data into the structured_data_extra_params extension, which will then be passed into the getLdStructuredData function in the Thread Entity.
HTML:
<xf:page option="ldJsonHtml">
<xf:extension name="structured_data_extra_params" value="{{ [] }}" />
<xf:extension name="structured_data">
<xf:set var="$ldJson"
value="{{ $thread.getLdStructuredData($firstPost, $page, extension_value('structured_data_extra_params')) }}"
/>
<xf:if is="$ldJson">
<script type="application/ld+json">
{$ldJson|json(true)|raw}
</script>
</xf:if>
</xf:extension>
</xf:page>
Upvote
0