How to Remove URL Parameters (m=0 and m=1) on Blogger Post or Pages

How to Remove URL Parameters (`m=0` and `m=1`) on Blogger Pages
If you're using Blogger and want to clean up URLs by removing certain parameters like m=0
and m=1
, you can use a simple JavaScript code snippet. This script will automatically clean up these parameters from the URL, ensuring a cleaner and more user-friendly link.
Adding the Script to Your Blogger Page
- Log in to your Blogger account.
- Go to the Dashboard of the blog you want to edit.
- Click on "Theme" in the left sidebar.
- Next to "Customize", click on "Edit HTML".
- In the HTML editor, locate the closing
</body>
tag. This is typically found towards the end of the HTML code. - Paste the following code snippet just above the closing
</body>
tag:
Code Snippet
Here's the JavaScript code you need to add:
<script type='text/javascript'> var uri = window.location.toString(); if (uri.indexOf("&m=1","&m=1") > 0) { var clean_uri = uri.substring(0, uri.indexOf("&m=1")); window.history.replaceState({}, document.title, clean_uri); } var uri = window.location.toString(); if (uri.indexOf("?m=1","?m=1") > 0) { var clean_uri = uri.substring(0, uri.indexOf("?m=1")); window.history.replaceState({}, document.title, clean_uri); } var uri = window.location.toString(); if (uri.indexOf("&m=0","&m=0") > 0) { var clean_uri = uri.substring(0, uri.indexOf("&m=0")) + uri.substring(uri.indexOf("&m=0") + 5); window.history.replaceState({}, document.title, clean_uri); } var uri = window.location.toString(); if (uri.indexOf("?m=0","?m=0") > 0) { var clean_uri = uri.substring(0, uri.indexOf("?m=0")) + uri.substring(uri.indexOf("?m=0") + 5); window.history.replaceState({}, document.title, clean_uri); } </script>
Conclusion
By following these steps, you can easily clean up unwanted URL parameters from your Blogger pages. This makes your URLs cleaner and more user-friendly. If you have any questions or need further assistance, feel free to ask!
Comments
Post a Comment