Promote Your Content by Creating a Custom "page Not Found" in Blogger


Awesome Tips Series about Blogger

Why Create a Custom Not Found Page?

We create a custom “Page Not Found” to promote posts when users land on not existing pages, also we can maintain our own custom redirects in Git.

Why not Use Custom Redirects in Search Preferences

We can add custom redirect at Settings -> Search Preferences -> Custom Redirects. But when we reset template, our custom redirects and other changes would be lost. When this happens, we have to re-add all redirects manually.

This happened to me once. So instead add these redirects again (a lot of click and typing), we would like to maintain the redirects in code and commit it into Git.

How to Create a Custom “Page Not Found”? in Blogger

There are different choices: - We can At Settings -> Search Preferences -> Under “Errors and Redirections” click the option to “Edit” Custom Page Not Found - Or we can create a normal web page. The benefit of this approach is that we can get the analytics of the 404 page, how many times visited ect, so we can decide whether and how to optimize it.

Maintain Custom Redirects in Code and Git

The advantage of this approach is that we can easily add or remove redirects. - As I use Atom Editor and Markdown to write posts, so I add the other redirects in this Markdown page, but Command+/ to comment and hide them. - the source code of the post is in Github, I can easily put it back when the change is lost.

Redirect to Archives Page

Be default, if there is no custom redirect defined for the missing page, it will redirect to the archives page. As we want

Search the Missing Page in Google

We can create one link in the 404 page to help the user to search the missing page in Google. When the user clicks the search link: we will get the last part of the path and search it in Google.
The user may find the post where we forget to add the redirect or find similar posts: another opportunity to let user explore our website.

We can auto redirect the 404 page to Google search page by window.location=the_url, but we want to keep the user in our website.
Notice that we can’t do both: redirect to archives page and open a new page for the Google search by window.open(url, '_blank'): as the browser will block pop-up that are not caused by trusted events like user clicks.

Promote Posts

We can promote popular posts if users land on wrong page (maybe the page is gone or user made a mistake). The code would be same as the post here: promote posts based on labels.

Also fix css and add the title: paste the above HTML code and add the following text before New Posts

Labels

adsense (5) Algorithm (69) Algorithm Series (35) Android (7) ANT (6) bat (8) Big Data (7) Blogger (14) Bugs (6) Cache (5) Chrome (19) Code Example (29) Code Quality (7) Coding Skills (5) Database (7) Debug (16) Design (5) Dev Tips (63) Eclipse (32) Git (5) Google (33) Guava (7) How to (9) Http Client (8) IDE (7) Interview (88) J2EE (13) J2SE (49) Java (186) JavaScript (27) JSON (7) Learning code (9) Lesson Learned (6) Linux (26) Lucene-Solr (112) Mac (10) Maven (8) Network (9) Nutch2 (18) Performance (9) PowerShell (11) Problem Solving (11) Programmer Skills (6) regex (5) Scala (6) Security (9) Soft Skills (38) Spring (22) System Design (11) Testing (7) Text Mining (14) Tips (17) Tools (24) Troubleshooting (29) UIMA (9) Web Development (19) Windows (21) xml (5)