Table of Content

How To Remove "?m=1" From Blogger Post URL

This article explains how to remove the ?m=1 parameter from Blogger post URLs by adding a JavaScript code snippet to your Blogger template.
Blogger post URL, ?m=1 parameter, remove ?m=1, Blogger SEO, mobile-friendly URLs, Blogger template,

Blogger post URLs have a ?m=1 parameter when viewed on mobile devices. This parameter is used to identify the device and serve a mobile-friendly version of the post. However, you may want to remove the ?m=1` parameter from your Blogger post URLs for aesthetic reasons or to improve SEO.

This article explains how to remove the ?m=1 parameter from Blogger post URLs by adding a JavaScript code snippet to your Blogger template.

To remove the ?m=1 parameter from Blogger post URLs, you can use the following JavaScript code:

(function() {
  // Get the current URL.
  var url = window.location.href;

  // Remove the `?m=1` parameter from the URL.
  if (url.indexOf('?m=1') > -1) {
    url = url.replace('?m=1', '');
  }

  // Redirect the user to the updated URL.
  window.location.replace(url);
})();

This code works by first getting the current URL of the page. It then checks to see if the ?m=1 parameter is present in the URL. If it is, the code removes the parameter and redirects the user to the updated URL.

To use this code, you need to add it to the <head> section of your Blogger template. To do this:

  1. Go to your Blogger dashboard and click on the Theme tab.
  2. Click on the Customize button.
  3. Click on the Edit HTML tab.
  4. Find the <head> tag and paste the code above it.
  5. Click on the Save Changes button.

Once you have added the code to your Blogger template, the ?m=1 parameter will be removed from all of your blog post URLs.

Here is a step-by-step explanation of each line of code:

(function() {

This line of code starts an anonymous function. Anonymous functions are functions that do not have a name.

  // Get the current URL.
  var url = window.location.href;

This line of code gets the current URL of the page and assigns it to the variable url.

  // Remove the `?m=1` parameter from the URL.
  if (url.indexOf('?m=1') > -1) {
    url = url.replace('?m=1', '');
  }

This line of code checks to see if the ?m=1 parameter is present in the URL. If it is, the code removes the parameter and assigns the updated URL to the variable url.

  // Redirect the user to the updated URL.
  window.location.replace(url);
})();

This line of code redirects the user to the updated URL.

Note: It is important to note that removing the ?m=1 parameter from Blogger post URLs will not affect your blog's SEO. Search engines are smart enough to understand that the mobile and desktop versions of your blog posts are the same content.

Post a Comment