• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

XF 1.4 How to put search box on search engine result?

clove28

Active member
#1
I've seen this in many sites but I don't know where to put the codes provided by google in xenforo template. Anybody knows where I could put it? I see that xenforo has it.

upload_2015-7-9_15-24-10.png
 

Russ

Well-known member
#2
Starting in... 1.4(? maybe), the page_container was updated with this snippet at the bottom:

Code:
<xen:if is="{$isIndexPage} AND {$canSearch}">
<script type="application/ld+json">
{
   "@context": "http://schema.org",
   "@type": "WebSite",
   "url": "{xen:jsescape {xen:link canonical:index}}",
   "potentialAction": {
     "@type": "SearchAction",
     "target": "{xen:jsescape {xen:link canonical:search/search}}{xen:if $xenOptions.useFriendlyUrls, '?', '&'}keywords={search_keywords}",
     "query-input": "required name=search_keywords"
   }
}
</script>
</xen:if>
I believe that's the related code, after that it just takes a little time.
 

clove28

Active member
#3
Starting in... 1.4(? maybe), the page_container was updated with this snippet at the bottom:

Code:
<xen:if is="{$isIndexPage} AND {$canSearch}">
<script type="application/ld+json">
{
   "@context": "http://schema.org",
   "@type": "WebSite",
   "url": "{xen:jsescape {xen:link canonical:index}}",
   "potentialAction": {
     "@type": "SearchAction",
     "target": "{xen:jsescape {xen:link canonical:search/search}}{xen:if $xenOptions.useFriendlyUrls, '?', '&'}keywords={search_keywords}",
     "query-input": "required name=search_keywords"
   }
}
</script>
</xen:if>
I believe that's the related code, after that it just takes a little time.
Thank you Russ! I'm going to try it now. :)
 

clove28

Active member
#5
Starting in... 1.4(? maybe), the page_container was updated with this snippet at the bottom:

Code:
<xen:if is="{$isIndexPage} AND {$canSearch}">
<script type="application/ld+json">
{
   "@context": "http://schema.org",
   "@type": "WebSite",
   "url": "{xen:jsescape {xen:link canonical:index}}",
   "potentialAction": {
     "@type": "SearchAction",
     "target": "{xen:jsescape {xen:link canonical:search/search}}{xen:if $xenOptions.useFriendlyUrls, '?', '&'}keywords={search_keywords}",
     "query-input": "required name=search_keywords"
   }
}
</script>
</xen:if>
I believe that's the related code, after that it just takes a little time.
Russ, I noticed that the code is already in my PAGE_CONTAINER template. But I didn't put that code. Is it a feature of Modest style?