Refine Indexing with noindex.xml

Use the noindex.xml file to exclude specific URLs or app notifications from Search results. This is only available for public content in your app.

  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>

Send feedback about...

Need help? Visit our support page.