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,
noindex.xmlfile. 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
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.
- Create a new XML file in your app's XML resources directory:
- 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:
<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>
- After you add the
noindex.xmlfile, reference it from a
meta-datatag within the
applicationsection of the app's
AndroidManifest.xmlfile with the following line:
<meta-data android:name="search-engine" android:resource="@xml/noindex" />