Keeping Views with Prevent Direct Access out of XML sitemaps
An XML sitemap lists your site’s URLs for search engines, Views included. A View with Prevent Direct Access on answers 404 at its own URL, so it should not be listed. GravityView leaves it out of the sitemap WordPress generates, and the Social Sharing & SEO extension, version 3.4 or newer, does the same for SEO plugins’ sitemaps.
Sitemaps that leave these Views out #
- The sitemap WordPress generates: GravityView does this itself, with or without the extension.
- Yoast SEO, Rank Math, All in One SEO, SEOPress, The SEO Framework, Slim SEO, Jetpack and SmartCrawl: with Social Sharing & SEO 3.4 or newer active.
There is nothing to configure: turn on Prevent Direct Access on the View and the exclusion follows. The sitemap keeps every View that has the setting off. Without the extension, Yoast SEO keeps listing a View after its URL stops working. Squirrly SEO is not covered.
To turn the setting on, see The Prevent Direct Access setting.
Check your sitemap #
Open the sitemap for Views and confirm the View is not listed:
- WordPress:
/wp-sitemap-posts-gravityview-1.xml - Yoast SEO:
/gravityview-sitemap.xml, linked from/sitemap_index.xml - Other SEO plugins: open the sitemap index the plugin generates and follow its link for Views.
WordPress’s and Yoast SEO’s sitemaps list no entry URLs, because entries are not posts. To ask search engines to skip entry pages, and to keep a public View out of search results, see Keeping Views and entries out of search engines.