Do you want to remove the date from the Blogger Post URL without losing the SEO ranking? In this post, I am going to show you how you can easily remove the date and .html extension from the BlogSpot post URL.
Every BlogSpot Blogger wants to customize the URL of the blog to make it looks professional and SEO friendly. Unfortunately, Unlike WordPress Blogger does not support URL customization by default. Today in this post, we will see how we can change the URL of the blogger post by JavaScript.
How URL will look after applying this trick?
By default, Blogger’s Post URL looks like this one:
https://www.freetoreads.com/2021/10/how-to-remove-m1-from-blogger-url.html
If we apply this trick to our blogger website then our new Blogger’s Post URL will look like this one:
https://www.freetoreads.com/how-to-remove-m1-from-blogger/
Obviously, the second one looks short, professional, and SEO-friendly.
Why we should use this technique?
Most new bloggers start their blogging journey with this free BlogSpot platform to gain experience. If you are planning to migrate your blog to WordPress in the future, then you should use this technique. With this code, we will remove the date and .html extension from the URL.
Then the blogger’s post URL will look similar to the WordPress post URL. This technique also has some disadvantages. We will discuss some advantages and disadvantages of this technique.
Advantages of Removing Date Form Blogger Post URL
- It will give a professional URL/Permalink to your Blog Post just like WordPress.
- It will not let visitors know the published date of the blog post.
- It will help you get a high ranking in Search Engines.
- It will make your URL short and easy to remember.
- Your Blog Post will look super professional.
The disadvantage of Removing the Date Form the Blogger Post URL
Removing the date and “.html” from the blogger post’s URL is good, but only for new bloggers. If you are ranked at the top of Google, then don’t take the risk of changing the URL of your posts, because changing the URL will affect your site’s ranking badly.
In addition, if your pages are ranked on google, then after applying this trick your visitor will get a “404 error”, you should use the blogger’s redirect feature to redirect to a new URL.
How to remove date and .html from Blogger Blog?
Copy the code in the below box. You should paste that code in your HTML code just before the body closing tag </head> and then save the code.
Steps to remove date from BlogSpot Site:
1. Step 01: Go To Blogger
2. Step 02: Go To Theme
3. Step 03: Click on Edit HTML
4. Step 04: Press CTRL+F and Find </head>
5. Step 05: Copy the Code Given Below.
6. Step 06: Paste That Code Above </head> Tag.
7. Step 07: Save your Code.
Code to remove date and .html in Blogger/BlogSpot Blog:
<script type="text/javascript">//<![CDATA[// BloggerJS v0.3.1// Copyright (c) 2017-2018 Kenny Cruz// Licensed under the MIT Licensevar urlTotal,nextPageToken,postsDatePrefix=!1,accessOnly=!1,useApiV3=!1,apiKey="",blogId="",postsOrPages=["pages","posts"],jsonIndex=1,secondRequest=!0,feedPriority=0,amp="&"[0];function urlVal(){var e=window.location.pathname,t=e.length;return".html"===e.substring(t-5)?0:t>1?1:2}function urlMod(){var e=window.location.pathname;"p"===e.substring(1,2)?(e=(e=e.substring(e.indexOf("/",1)+1)).substr(0,e.indexOf(".html")),history.replaceState(null,null,"../"+e)):(e=(e=postsDatePrefix?e.substring(1):e.substring(e.indexOf("/",7)+1)).substr(0,e.indexOf(".html")),history.replaceState(null,null,"../../"+e))}function urlSearch(e,t){var n=e+".html";t.forEach(function(e){-1!==e.search(n)&&(window.location=e)})}function urlManager(){var e=urlVal();0===e?accessOnly||urlMod():1===e?getJSON(postsOrPages[feedPriority],1):2===e&&(accessOnly||history.replaceState(null,null,"/"))}function getJSON(e,t){var n=document.createElement("script");if(useApiV3){var o="https://www.googleapis.com/blogger/v3/blogs/"+blogId+"/"+e+"?key="+apiKey+"#maxResults=500#fields=nextPageToken%2Citems(url)#callback=bloggerJSON";nextPageToken&&(o+="#pageToken="+nextPageToken),nextPageToken=void 0}else o=window.location.protocol+"//"+window.location.hostname+"/feeds/"+e+"/default?start-index="+t+"#max-results=150#orderby=published#alt=json-in-script#callback=bloggerJSON";o=o.replace(/#/g,amp),n.type="text/javascript",n.src=o,document.getElementsByTagName("head")[0].appendChild(n)}function bloggerJSON(e){var t=[];if(useApiV3||void 0===urlTotal&&(urlTotal=parseInt(e.feed.openSearch$totalResults.$t)),useApiV3){try{e.items.forEach(function(e,n){t.push(e.url)})}catch(e){}nextPageToken=e.nextPageToken}else try{e.feed.entry.forEach(function(n,o){var r=e.feed.entry[o];r.link.forEach(function(e,n){"alternate"===r.link[n].rel&&t.push(r.link[n].href)})})}catch(e){}urlSearch(window.location.pathname,t),urlTotal>150?(jsonIndex+=150,urlTotal-=150,getJSON(postsOrPages[feedPriority],jsonIndex)):nextPageToken?getJSON(postsOrPages[feedPriority]):secondRequest&&(nextPageToken=void 0,urlTotal=void 0,jsonIndex=1,secondRequest=!1,0===feedPriority?(feedPriority=1,getJSON("posts",1)):1===feedPriority&&(feedPriority=0,getJSON("pages",1)))}function bloggerJS(e){e&&(feedPriority=e),urlManager()}bloggerJS();//]]></script>
Note: This code will remove the date from your blogger blog. It will also remove “.html” from your blogger’s blog URL.