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

Google Custom Search?

Discussion in 'XenForo Questions and Support' started by smsmasters, Oct 6, 2011.

  1. smsmasters

    smsmasters Active Member

    I'm not sure if this has been posted before but is there some soft of google custom search integration/mod?
     
  2. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Do you want to add a Google search form to your site? Try this:

    Admin CP -> Appearance -> Templates -> forum_list

    Add the red code, and change the blue code to your domain name:

    Code:
    <xen:h1>{$xenOptions.boardTitle}</xen:h1>
    
    <xen:container var="$head.canonical"><link rel="canonical" href="{xen:link 'canonical:index'}" /></xen:container>
    <xen:if is="{$xenOptions.boardDescription}"><xen:container var="$head.description">
    	<meta name="description" content="{$xenOptions.boardDescription}" /></xen:container></xen:if>
    <xen:container var="$head.openGraph">
    	<xen:include template="open_graph_meta">
    		<xen:set var="$url">{xen:link 'canonical:index'}</xen:set>
    		<xen:set var="$title">{$xenOptions.boardTitle}</xen:set>
    	</xen:include></xen:container>
    
    <xen:hook name="forum_list_nodes">
    	<xen:if is="{$renderedNodes}"><xen:include template="node_list" /></xen:if>
    </xen:hook>
    	
    <xen:sidebar>
    	<xen:edithint template="sidebar.css" />
    
    	<div class="section">
    		<div class="secondaryContent">
    			<h3>Google This Site</h3>
    			<form method="get" action="http://www.google.com/search">
    				<input type="text" name="q" placeholder="Search..." size="31" maxlength="255" value="" /><br />
    				<input type="hidden" name="sitesearch" value="yoursite.com" />
    				<input type="submit" value="Search" />
    			</form>
    		</div>
    	</div>
    
    	<xen:hook name="forum_list_sidebar">
    		<xen:include template="sidebar_online_users" />
    		
    		<!-- block: forum_stats -->
    		<div class="section">
    			<div class="secondaryContent statsList" id="boardStats">
    				<h3>{xen:phrase forum_statistics}</h3>
    				<div class="pairsJustified">
    					<dl class="discussionCount"><dt>{xen:phrase discussions}:</dt>
    						<dd>{xen:number $boardTotals.discussions}</dd></dl>
    					<dl class="messageCount"><dt>{xen:phrase messages}:</dt>
    						<dd>{xen:number $boardTotals.messages}</dd></dl>
    					<dl class="memberCount"><dt>{xen:phrase members_count}:</dt>
    						<dd>{xen:number $boardTotals.users}</dd></dl>
    					<dl><dt>{xen:phrase latest_member}:</dt>
    						<dd><xen:username user="$boardTotals.latestUser" /></dd></dl>
    					<!-- slot: forum_stats_extra -->
    				</div>
    			</div>
    		</div>
    		<!-- end block: forum_stats -->
    		
    		<xen:include template="sidebar_share_page">
    			<xen:set var="$url">{xen:link canonical:index}</xen:set>
    		</xen:include>
    		
    	</xen:hook>
    </xen:sidebar>
    
    It will show in the sidebar on the index page, like this:

    Screen shot 2011-10-06 at 3.56.57 PM.png
     
    maszd, macara, CRDeveloper and 4 others like this.
  3. Phillip

    Phillip Active Member

    Will this work with Adsense search code as well? We'd like to incorporate adsense search into our forum. I'm sure others would like this too.
     
    Bellinis likes this.
  4. smsmasters

    smsmasters Active Member

    Would like that too!
     
  5. smsmasters

    smsmasters Active Member

    Any luck?
     
  6. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Sorry I don't use Adsense. I am only familiar with their site search feature.

    If Adsense offers a different search feature then you can probably find that inside of your Adsense account.
     
    smsmasters likes this.
  7. smsmasters

    smsmasters Active Member

Share This Page