Wednesday, 4 July 2012

How to recover a deleted post in Blogger

It is very easy to accidentally delete a post in Blogger, especially when mass deleting posts, as it is common that a precious post keeps a previous selection and gets deleted with the unwanted ones.

It happened to me as well. Unfortunately, Blogger does not provide any help for restoring a deleted post, but fortunately I kept a backup copy of my blog and just re-posted it again. I noticed, though, that the html link to the post was different (even if re-posted with the same date and title of the old one). It was the same as before, but with a -01.html at the end.
This is bad, because everybody who made a link to the old post now linked to a 404 Error (non existent URL).

This gave me the suspicion that Blogger stored the deleted posts somewhere, and I found a way to restore it fully, with pictures, number of views and comments.

The 5 steps to recover a deleted post in Blogger

  1. First of all you need to retrieve your deleted post ID. If you have it, you can skip to step 4. If you don't have it, the only solution is to find it in cached web pages from search engines. For this reasons, this procedure will not work for very new posts or private blogs.
  2. Find your old post in any search engine. For example, for my previous post, I googled "natural selection and prime numbers" and I have found the URL "http://www.badscientist.net/2012/06/natural-selection-and-prime-numbers.html". Now you need to access the cached content (click on Cached in Google when hovering with the mouse on the >>).
  3. Access the Source code (in Firefox, right-click anywhere in the page and "View Page Source") and find this line:

    <div class='post-outer'>
    <div class='post hentry' itemscope='itemscope' itemtype='http://schema.org/BlogPosting'>
    <a name='2003347239440929962'>a>
    <h3 class='post-title entry-title' itemprop='name'>
    Natural selection and prime numbers
    h3>
    
    
    Here, the post ID is 2003347239440929962.
  4. Now that you have the post ID, create a new post in your blog, the usual way. In the URL bar you see above the editing fields, for example:

    http://www.blogger.com/blogger.g?blogID=4658705474308031765#editor/target=post;postID=2231649307872317536

    replace the number after postID with the deleted post ID. In this case, I will replace  2231649307872317536  with  2003347239440929962  .

  5. Press Enter and your old deleted post will (magically) reappear. You can edit it again or just press Publish to have it back.

Hope this helps, let me know if there are easier ways to do that.

In order to prevent this from happening again, I revert to draft posts, instead of deleting them directly. The posts, this way, will not be on the web, but it will give me time to see if I did any mistakes before deleting a post completely.