Is there a way to stop a custom 404 page from being added to the Popular Content block?

I set up a node for the custom 404 page. But every time a missing page gets redirected there, it increases the number of page hits of that node (of course). Which increases its ranking in Popular Content blocks also.

Is there some configuration setting to exclude it from Popular Content blocks, or place it in a different category?


Option 1: Use the CustomError module

The CustomError module allows a site administrator to create custom error pages for HTTP status codes 403 (access denied) and 404 (not found), without the need to create nodes for each of them. Some more details about its features (from its project page):

  • Configurable page title and descriptions.
  • There are no author and date/time headers as with normal nodes.
  • Any HTML formatted text can be be put in the page body.
  • The error pages are themable.
  • Users who are not logged in and try to access an area that requires login will be redirected to the page they were trying to access after they login.
  • Allows custom redirects for 404s.

What you should be most interested in, is this part from that project page:

Since the error pages are not real nodes, they do not have a specific content type, and will not show up in node listings, or in a Popular Content block.

Option 2: Tune the View that creates the block

Edit the View that actually creates the Popular Content Block like so:

  • Use the "Add" link to add an extra condition within "Filter Criteria".
  • The extra condition could be either of these:

    1. "Content: nid", using "Is not equal to" as operator, and with "value" the node id for your 404 page.
    2. "Content type" is different from "Content type ABC", whereras you first created such Content type ABC to create pages such as the custom 404 page (which automatically also covers other similar pages you want to always be excluded also).

Bonus: Also for 403 variations

Either option above can be used in case of a similar question related to 403 errors (Forbidden, or "Access Denied").

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.