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

XF 1.4 SearchAction markup for Google?

Discussion in 'XenForo Questions and Support' started by dethfire, Sep 15, 2014.

  1. dethfire

    dethfire Well-Known Member

    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?
     
  2. kontrabass

    kontrabass Well-Known Member

    I got the same email and am wondering the same thing. Going by the example on this page, it shouldn't be too difficult, but I really have no idea what I'm talking about. It seems like maybe we need to get XF's search results URL to fit:

    target":"https://host.example-petstore.com/search?q={search_term}"

    Having a search box under our google search result would be ultra cool...
     
    dethfire likes this.
  3. Breixo

    Breixo Active Member

    +1, any idea what to change in Xenforo? ;)
     
  4. BamaStangGuy

    BamaStangGuy Well-Known Member

    Make your site ready for the new sitelinks search box
    September 15, 2014


    To: Webmaster of http://www.aspiescentral.com/,

    Google systems have detected that your site may be eligible for the new sitelinks search box. With it, you can make it easier for your visitors to reach specific content on your site directly from Google Search. We want to help you set up your site to take advantage of the new search box.

    Here’s how to make sure your site is ready:
    1Verify you’ve got a functioning site-specific search engine
    If you’ve got a Google Custom Search Engine, that works too.
    2Add the necessary markup to your site's homepage
    We recommend using schema.org/SearchAction markup with JSON-LD, but you can also use microdata.
    3Set up a preferred canonical URL for your homepage
    Make sure all other page versions point to the one you want (use the rel="canonical" link element)
    Need more help?
    •Learn more about Sitelinks Search box on our blog.
    •See setup and code samples on our Sitelinks Searchbox guide.
    Ask more questions on the forum - mention message type [WNC-389902]

    Is this something that is already built into XenForo, specifically the number 2 option?
     
    dethfire likes this.
  5. dethfire

    dethfire Well-Known Member

  6. dethfire

    dethfire Well-Known Member

    RoldanLT likes this.
  7. zagorskey

    zagorskey Active Member

    I'm also curious. Xenforo's search method returns a link in this form:

    Code:
    http://website.com/search/118457/?q={what_you_searched_for}&o=date
    so apparently every search being made has its own ID. How can we get the variable generating that one?
     
  8. Andy.N

    Andy.N Well-Known Member

    Wow, that is nice.
    Looks like Xenforo is already showing that search box

    Screen Shot 2014-09-21 at 2.51.43 PM.png
     
  9. RoldanLT

    RoldanLT Well-Known Member

    My site is even showing that box: upload_2014-9-22_6-50-33.png


    But still do not support the auto suggest.
     
  10. zagorskey

    zagorskey Active Member

    I can't see any custom modifications to your code so I guess it happens automatically and we just have to be patient.
     
  11. RoldanLT

    RoldanLT Well-Known Member

    Me? Yes i don't have any special modification on my site.
     
    zagorskey likes this.
  12. FredC

    FredC Well-Known Member

    Is this already something XF does with Microdata? Do we need to do any of the install steps listed in this thread?

    Code:
    <div itemscope itemtype="http://schema.org/WebSite">
      <meta itemprop="url" content="https://www.example-petstore.com/"/>
      <form itemprop="potentialAction" itemscope itemtype="http://schema.org/SearchAction">
        <meta itemprop="target" content="https://query.example-petstore.com/search?q={search_term_string}"/>
        <input itemprop="query-input" type="text" name="search_term_string" required/>
        <input type="submit"/>
      </form>
    </div>
    and if not where would the above example go?
     
  13. Sunka

    Sunka Well-Known Member

    Any news about this? :confused:
     
  14. Mike

    Mike XenForo Developer Staff Member

    It's actually running here now, but need to wait for Google to pick it up. There isn't any direct way to test it.
     
    RoldanLT likes this.
  15. Sunka

    Sunka Well-Known Member

    @Mike yes, but where exactly to put this code.
    My forum is www.pijanitvor.com.
    What exactly to put in this row: <metaitemprop="target"content="http://query.pijanitvor.com/search?q={search_term_string}"/>
    Couse search on my forum have this part in link /search/168626/?q=orada&o=date
    So apparently every search being made has its own ID. How can we get the variable generating that one?

    Is that code below correct? If yes, I have to put that code anywhere in home page. What template?

    Code:
    <div itemscope itemtype="http://schema.org/WebSite">
      <meta itemprop="url" content="http://www.pijanitvor.com/"/>
      <form itemprop="potentialAction" itemscope itemtype="http://schema.org/SearchAction">
        <meta itemprop="target" content="http://query.pijanitvor.com/search/?q={search_term_string}"/>
        <input itemprop="query-input" type="text" name="search_term_string" required/>
        <input type="submit"/>
      </form>
    </div>
     
  16. RoldanLT

    RoldanLT Well-Known Member

    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.
     
    Sunka likes this.
  17. Sunka

    Sunka Well-Known Member

    You mean like this:
    Code:
    <footer>
        <xen:include template="footer" />
    </footer>
    
    <xen:if is="{$contentTemplate} == 'forum_list'">
    <script type="application/ld+json">
    {
      "@context": "http://schema.org",
      "@type": "WebSite",
      "url": "http://www.pijanitvor.com/",
      "potentialAction": {
        "@type": "SearchAction",
        "target": "http://www.pijanitvor.com/search/search?keywords={search_keywords}",
        "query-input": "required name=search_keywords"
      }
    }
    </script>
    </xen:if>
    
    <xen:include template="page_container_js_body" />
    
    </xen:hook>
    </body>
    </html>
     
  18. RoldanLT

    RoldanLT Well-Known Member

    I did it like this:
    HTML:
    <footer>
        <xen:include template="footer" />
    </footer>
    
    <xen:include template="page_container_js_body" />
    <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>
    </xen:hook>
    </body>
    </html>
     
  19. Sunka

    Sunka Well-Known Member

    Only diference is this line. Is that from this script or from some other add on.
    Code:
    <xen:include template="page_container_js_body" />
     
  20. RoldanLT

    RoldanLT Well-Known Member

    I think that's default from XenForo.
     

Share This Page