Design + Coding > customize 'page not found' page?
for now i put a sidebar here -- to do this i had to selectively show this sidebar when all other pages (except contact) are not active by checking off every page on the site - and will have to remember to update this every time a new page is added, which does not work for client edits.
i need to be able to specify this page with an id number in the css so i can permanently have a sidebar on this page or adjust the content to full width with no sidebar.
VUELA
or - list the 'not found' page in the list of pages when you want to show / hide sidebars. that would work too. but being able to reference / edit the page itself in the css would be better.
ideas?
VUELA
Here I think I can help with a good 'ol fashioned jQuery script. Let me understand exactly what you are trying to do first. Basically you want a sidebar that does not exist on other pages, but add it automatically to this error page only? If so, please create the sidebar on a normal page temporarily, and send me the ID number of that sidebar (i.e. sectionContent1493923) or whatever it is called. Then I can create the script to add that sidebar to the Error page only.
If that's what you need, please go ahead and email me or just post your reply.
- Chris
Chris Cox
How about actually supporting a custom 404 page?
I have just found out about SQ's utter lack of support for the fact that when you move a site here, you may be forced to change URLs. (For example, if a previous CMS makes files with a different extension besides .HTML as is the case with my site.
The only solution is to take each URL and paste it MANUALLY, ONE AT A TIME into the URL Shortcut tool -- and for me that tool is even broken, and not executing the URL Shortcuts. I am left with NO PROVISION WHATSOEVER to handle my broken links.
To then not offer a custom 404 page... or even the ability to designate a certain page as the 404 page (for instance, homepage, or the blog archives).. that's adding insult to injury.
If you're calling yourself a premium service AND not providing any kind of server-side access to your customers to handle these needs, the you MUST make your own provision for these issues.
I HAD to move the site back to SQ because my husband, whose blog it is, insisted on not having to learn a new system. But I have been strongly disincentivized against moving any other site here. I will only open a new site here.
Bonnie Gibbons
Hi Chris - Right now I have an existing contact sidebar (already used on the contact page) showing up on the 'Page Not Found' page - and this is fine with me ... i just don't want to have to go in and update the sidebar section's selective display every time I add a page, change page names or update the architecture in any other way ... I would much rather hard code this in permanently.
The ID for the contact sidebar is: sectionContent1493923
Hooray again for jQuery!
+ Dana .
VUELA
Hi Dana and Bonnie,
Here is a cool workaround. This JavaScript will check the title of the page, and determine if it's an error page. If so, it will redirect to a new URL that you specify.
Therefore, simply create a new page and style it any way you wish. Then add the following script to the Extra Header Code section.
Make sure you put your new URL in the code below where I have shown.
<script type="text/javascript">
//Redirect from error page to your new custom error page
var redirectURL = "http://ENTER YOUR NEW ERROR PAGE URL HERE";
if(document.title == Squarespace.Constants.WEBSITE_TITLE + " - Page Not Found"){
location = redirectURL;
};
</script>
That's it. Let me know if any more problems with that.
- Chris
Chris Cox
this is great! thanks!
VUELA
Chris,
This is a great tool. If I could get it to work. Do I need to add anything else to call the js besides your snippet above? Here's my page: rockbridgeseminary.org/broken Thanks!
Brian Schmitt
Hi Brian...
I checked out your page. What's happening is your error page title includes "Rockbridge Seminary online", whereas your revised script is looking for "Rockbridge Seminary".
Therefore, here is a script that will work for your site:
<script type="text/javascript">
var redirectURL = "http://www.rockbridgeseminary.org";
if(document.title == "Page Not Found - " + Squarespace.Constants.WEBSITE_TITLE + " online"){
location = redirectURL;
};
</script>
Also, looks like you have an additional error checking page per the "Broken" page you sent in this post. Therefore to redirect from that type of error page, you need to put "Sorry, That link is broken" which would replace "Page Not Found" within the above script. Alternatively you can add both and handle both redirections within the same script.
- Chris Cox
Chris Cox
That was it. Thanks Chris!
Brian Schmitt
I can't seem to get this to work:
I want to redirect to a page, "/page-not-found"
From a page which would have the title "Page Not Found - Interaction learning and development"
So, I'm using the code:
<script type="text/javascript">
var redirectURL = "/page-not-found";
if(document.title == "Page Not Found - " + Squarespace.Constants.WEBSITE_TITLE){
location = redirectURL;
};
</script>
What am I getting wrong?
Thanks
Mike
Mike T
Mike,
From the instructions provided by Chris Cox above, I would assume that you were supposed to substitute your actual site title (see your Website Settings>Header and Footer in the admin area) where it says WEBSITE_TITLE. Did you do that?
I may be wrong, but it's something to try.
--Chris
Chris Loosley
Well, I tried pretty much everything. The Website tile is (I think) "Interaction learning and development", so I've tried that with spaces and with underscores in the spaces. Then I decided "Squarespace.Constants.WEBSITE_TITLE" was perhaps a generic variable.
Then I gave up and posted!
I just can't seem to crack it.
Mike T
Hi Mike,
What's the URL of your site. I'll check it out to see what's going on.
Thanks,
Chris Cox
Chris Cox
http://www.interaction-ld.com
I may have commented out the script for the time being - do you need me to "comment it in"
Mike T
Mike, not sure I see what the problem is here. Your script is directing any unknown pages to http://www.interaction-ld.com/page-not-found, and it is correctly doing so. For example, if I go to http://www.interaction-ld.com/badurl, then it redirects to your new page-not-found page.
That seems like the desired effect. What's not working? Or what are you trying to do differently?
-Chris
Chris Cox
Oo-er!
How very strange. It wasn't working - honest.
Thanks very much your persistence and for highlighting the absence of my problem!
Even more, I have now solved the problem I raised with selective display not working on a "page not found", in this thread.
I will update that post with this thread.
Hooray!
Mike T
Hehe.
Well anytime I can not even raise a finger and do nothing to solve a problem, the better!
-Chris Cox
Chris Cox
Mike,
When this happens to me it usually turns out to have been caused by my not reloading the page often enough when testing script changes. It may take two page refreshes to force the browser to use the latest version.
--Chris
Chris Loosley



Is there anyway to access an id number or something to customize the page that comes up for 'Page Not Found'? I need to adjust the sidebars that come up, or the content width something to get this page to look ok.
http://kpg.squarespace.com/notfound