[wp-hackers] Should Monthly Archive Pages ever return 404?

Simon Wheatley simon at sweetinteraction.com
Wed Mar 11 10:38:41 GMT 2009


2009/3/10 Ade Walker <photofantaisie at gmail.com>:
>
> Perhaps I'm missing the point completely, but if the loop in the relevant
> theme template file simply includes an "else", eg this (much simplified,
> just to illustrate the point)...
>
> if (have_posts) : while (have_posts etc etc
> // Post content
> endwhile; else :
> // "There are aren't any posts this month. I was too lazy to write one!"
> endif;
>
> Then no 404, and something reasonably useful is communicated to the user -
> who then might be tempted to click on a real link in the sidebar etc. In
> other words, it seems to me a template issue rather than anything
> fundamentally flawed with how WP handles queries. Just my two centimes
> worth. :-)
>


I think there are two intertwingled issues here:

 * The HTTP status code [1] which WordPress responds with (currently
404 Not Found)
 * The user experience of coming across an archive with nothing in it

I would argue that the 404 status code is *absolutely* the correct
response here. Nothing has been found, so we send Not Found; if we
sent another response then Search Engines might start cataloguing this
page and that is (almost certainly) not what we want.

The user experience is another matter. Arguably when you come across
an archive which has no content you want to give the user some
response which is appropriate to the archive type, e.g. you might want
to point people to or show them a tag cloud for tag archive. For most
websites I would think that a user coming across an archive page which
has nothing on it is a pretty edge case scenario; how have they got
there? There's unlikely to be links from breadcrumbs, or "this post
published on {date}" type meta, etc. The only time I've had issues
with this has been for author archives; on one site we listed the
authors and wanted to link to their "home" archive page so people
could read their bios, etc, but WP didn't create those archives until
they'd written a post.

So in summary, I kinda see your point but I think you're dealing with
edge cases... and the core software doesn't need to deal with those
edge cases IMO.

Cheers,

S


[1] http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html


---
Sweet Interaction Ltd is Registered in England/Wales, no. 6610741
Registered office: 7 Malton Av, Manchester, M21 8AT


More information about the wp-hackers mailing list