Refine Public Content Indexing

If your public app content includes elements you don’t want to include in Google Search results, you can make the following adjustments:

  • Exclude specific pages from Search results: To specify the URLs you want to exclude from Google Search results, create a noindex.xml file. This is similar to how the robots noindex meta tag works for websites.
  • Exclude real-time app notifications from Search results: Add a specific exclude tag for app notifications to the noindex.xml file.

Flag excluded URLs

To exclude specific URLs or app notifications from Search results, set up a noindex.xml file. The noindex.xml file includes information about the URLs you want to exclude, so Google can identify these links and exclude them from Search results. You can only exclude public content in your app from Google Search results. Personal content is only included in on-device results from In Apps searches.

  1. Create a new XML file in your app's XML resources directory: res/xml/noindex.xml.
  2. Use statements with specific attributes to indicate the parts of your app to exclude from Google Search. These attributes are as follows:
    • uri—Excludes a specific URI from Google Search. Google doesn't index URLs that exactly match this attribute.
    • uriPrefix—Excludes all content below a URI path from Google Search. Google doesn't index URLs starting with a string matching this attribute.
    • android:value="notification"—Excludes your app's notifications from Google Search. Google doesn't index the notifications of the app if you specify this attribute.

    In the following example, the noindex.xml file includes statements that exclude app notifications, a specific page, and hidden directories from Google Search results:

      <?xml version="1.0" encoding="utf-8"?>
      <search-engine xmlns:android="http://schemas.android.com/apk/res/android">
        <noindex android:value="notification"/>
        <noindex uri="http://recipe-app.com/profile/hidden-page"/>
        <noindex uriPrefix="http://recipe-app.com/users/hidden_prefix"/>
      </search-engine>
  3. After you add the noindex.xml file, reference it from the application section of the app's AndroidManifest.xml file with the following line:
      <meta-data android:name="search-engine"
        android:resource="@xml/noindex"/>

    For example:

      <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.recipe_app">
        <application>
          <activity android:name=".client.HomeActivity" ...>
            ...
          </activity>
          <meta-data android:name="search-engine" android:resource="@xml/noindex"/>
        </application>
        ...
      </manifest>

Next: Enable Personal Content Indexing

Send feedback about...

Need help? Visit our support page.