XF 1.4 SearchAction markup for Google?

dethfire

Well-known member
Licensed customer
I got an email from Google saying "Make your site ready for the new sitelinks search box".

They say I need to:
Add the necessary markup to your site's homepage
We recommend using schema.org/SearchAction markup with JSON-LD, but you can also use microdata.

Does Xenforo support this?
 
For now, if any want's to implement it.
Add this code on PAGE_CONTAINER template below footer area.
Code:
<xen:if is="{$contentTemplate} == 'forum_list'">
<script type="application/ld+json">
{
  "@context": "http://schema.org",
  "@type": "WebSite",
  "url": "https://www.phcorner.net/",
  "potentialAction": {
    "@type": "SearchAction",
    "target": "https://www.phcorner.net/search/search?keywords={search_keywords}",
    "query-input": "required name=search_keywords"
  }
}
</script>
</xen:if>

Just replace with your own domain.
I implement it already almost a week now.


do we still have to do this with 1.4.2 or it's already in core?

thank
 
I never made any xf changes for it, and about a week after google sending that email the search box showed up for us. We're using elastic search if that matters.
 
For now, if any want's to implement it.
Add this code on PAGE_CONTAINER template below footer area.
Code:
<xen:if is="{$contentTemplate} == 'forum_list'">
<script type="application/ld+json">
{
  "@context": "http://schema.org",
  "@type": "WebSite",
  "url": "https://www.phcorner.net/",
  "potentialAction": {
    "@type": "SearchAction",
    "target": "https://www.phcorner.net/search/search?keywords={search_keywords}",
    "query-input": "required name=search_keywords"
  }
}
</script>
</xen:if>

Just replace with your own domain.
I implement it already almost a week now.
I have XenForo Enhanced Search
ask how to fix code ?

Thanks you
 
Back
Top Bottom