Custom Error Pages

This feels like an Omeka S 101 question, but I don’t think I’m seeing it anywhere, either in the docs or in the forums:
How do I customize the error pages?

I created view/error/ in my Theme directory, copied 404.phtml and index.phtml in there from core, and made changes, but forcing a 404 on my site shows the old error page.

There must be more (or less) to it, but I’m not finding the right stuff.

OK, the derp part is of course this isn’t touching a Theme, but then I’m still wondering how I could do this. Is there a way to impose a Theme on error pages?

Some errors do display “within” the theme, 404s that are “underneath” a site should already be using that site’s theme and are overridable with the usual method.

Things that use the blue “minimal” display… as you say, there’s no theme being applied to them. The view is just as overridable as any other, but the theme’s views just aren’t used in that context (among other reasons, there’s no way for Omeka S to tell what theme should be used for such “generic” contexts). Editing the actual view is an option of course but comes with the usual issues of maintainability.

A module can override that view like any other, though, so that’s a pretty simple option.

Out of curiosity, what kinds of changes are you looking to make?

Right – less derp than I originally thought.

For changes, my idea is to pull some university/library identity baselines into the error pages, and maybe some additional UX assistance. Moving things a little toward the kind of 404 a visitor would or should get on the uni site or library site, e.g. “Perhaps you could try searching over here . . .”

I’m more intimidated by the module creation idea than you think one might be, but I’ll look into it.

It looks like there’s variable error page calling, something I’d like to confirm or contradict.

When I request example.tld/s/slug/page/foo (and foo doesn’t exist), Omeka doesn’t seem to use my Theme error overrides, but when I request example.tld/s/slug/foo, it does. Is there a way to require my Theme error page for everything under the Site root URL?

(This feels like a continuation of the original question to me, but I’ll create a new thread if that’s more appropriate.)

What does the “page” version look like? Is it the “blue” minimal page, or is it a totally -unstyled page?

If it’s the latter, I think this is just a consequence of a bug I recently filed an issue for.

Totally unstyled.

(With some extra characters in a parenthetical to meet the forum software’s floor for message length.)

Okay, that’s likely the issue then.

If your site is marked public, have you checked if the behavior differs? The “white screen” error, at least the one I have recorded, comes from trying to render the admin bar for a nonexistent page, so if the bar is not being rendered at all (as is the default for visitors), then this shouldn’t be a problem.

Indeed! When logged in, the private/public doesn’t matter, but when visiting the site as unauthenticated visitor, the error is rendered in-theme in both cases.

Different error page sources, though, for what would seem to be the same error. slug/page/foo gets error/404.phtml but slug/foo gets error/index.phtml. This could be technically true, but would be confusing to users, and is difficult for us as site admins to plan for.

Okay. The first issue of logged-in vs. logged-out is represented by the issue I’ve already filed. The second, about “encountered an error” vs. 404 on certain kinds of mistaken URLs, is a slightly different issue that I’ll have to look at more.

1 Like