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

Google Custom Search?

Jake Bunce

XenForo moderator
Staff member
#2
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
 

Jake Bunce

XenForo moderator
Staff member
#6
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.