blob: f0339d65e503bbdaac56bfcbce2f7e563db2309e [file] [log] [blame]
page.title=Specifying App Content for Indexing
<!-- This is the training bar -->
<div id="tb-wrapper">
<div id="tb">
<h2>This lesson teaches you to</h2>
<li><a href="#sitemap">Add Deep Links in Your Sitemap</a></li>
<li><a href="#webpages">Add Deep Links in Your Web Pages</a></li>
<li><a href="#robots">Allow Google to Crawl URLs Requested By Your App</a></li>
<h2>You should also read</h2>
<li><a href="" class="external-link" target="_blank">Webmaster Tools</a></li>
<li><a href="" class="external-link" target="_blank">Creating Sitemaps</a></li>
<li><a href="" class="external-link" target="_blank">Googlebot</a></li>
<p>Google's web crawling bot (<a href="" class="external-link" target="_blank">Googlebot</a>), which crawls and indexes web sites
for the Google search engine, can also index content in your Android app.
By opting in, you can allow Googlebot to crawl the content in the APK
through the Google Play Store to index the app content. To indicate which app
content you’d like Google to index, simply add link elements either to
your existing <a href="" class="external-link" target="_blank">Sitemap</a> file or in the {@code &lt;head&gt;} element of each web
page in your site, in the same way as you would for web pages.</p>
<p>The deep links that you share with Google Search must take this URI
<p>The components that make up the URI format are:</p>
<li><strong>package_name.</strong> Represents the package name for your APK as
listed in the <a href="" class="external-link" target="_blank">Google Play Developer Console</a>.</li>
<li><strong>scheme.</strong> The URI scheme that matches your intent filter.</li>
<li><strong>host_path.</strong> Identifies the specific content within your application.
<p>The following sections describe how to add a deep link URI to your Sitemap
or web pages.</p>
<h2 id="sitemap">Add Deep Links in Your Sitemap</h2>
<p>To annotate the deep link for Google Search app indexing in your
<a href="" class="external-link" target="_blank">Sitemap</a>, use the
{@code &lt;xhtml:link&gt;} tag and specify the deep link as an alternate URI.</p>
<p>For example, the following XML snippet shows how you might specify a link to
your web page by using the {@code &lt;loc&gt;} tag, and a corresponding deep
link to your Android app by using the {@code &lt;xhtml:link&gt;} tag.</p>
&lt;?xml version="1.0" encoding="UTF-8" ?&gt;
href="android-app://" /&gt;
<h2 id="webpages">Add Deep Links in Your Web Pages</h2>
<p>Instead of specifying the deep links for Google Search app indexing in your
Sitemap file, you can annotate the deep links in the HTML markup of your web
pages. You can do this in the {@code &lt;head&gt;} section for each web
page by adding a {@code &lt;link&gt;} tag and specifying the deep link as an
alternate URI.</p>
<p>For example, the following HTML snippet shows how you might specify the
corresponding deep link in a web page that has the URL
{@code example://gizmos}.</p>
&lt;link rel="alternate"
href="android-app://" /&gt;
&lt;body&gt; ... &lt;/body&gt;
<h2 id="robots">Allow Google to Crawl URLs Requested By Your App</h2>
<p>Typically, you control how Googlebot crawls publicly accessible URLs on
your site by using a <a href="" class="external-link" target="_blank">{@code robots.txt}</a>
file. When Googlebot indexes your app content, your app might make HTTP
requests as part of its normal operations. However, these requests will
appear to your servers as originating from Googlebot. Therefore, you must
configure your server's {@code robots.txt} file properly to allow these
<p>For example, the following {@code robots.txt} directive shows how you might
allow access to a specific directory in your web site (for example,
{@code /api/}) that your app needs to access, while restricting Googlebot's
access to other parts of your site.</p>
User-Agent: Googlebot
Allow: /api/
Disallow: /
<p>To learn more about how to modify {@code robots.txt} to control web
crawling, see the <a href="" class="external-link" target="_blank">Controlling Crawling
and Indexing Getting Started</a> guide.</p>