How shall I create Automatic Internal Links in Blogger Blogspot?

People are currently reading this guide.

To create automatic internal links in a Blogger blogspot blog, follow these steps:

First, Add Robots txt in the Settings

  • Log in to your Blogger account and go to the dashboard.
  • Click on the "Settings" tab, and then click on the "Search preferences" option.
  • Scroll down to the "Crawlers and indexing" section, and then click on the "Edit" button next to the "Custom robots.txt" option.
  • In the "Custom robots.txt" editor, add the following line at the bottom:
  • Sitemap: https://yourblog.blogspot.com/sitemap.xml
  • Replace "yourblog" with the name of your blog, and then click on the "Save changes" button.

Now, Add JavaScript in the Template

  • Next, go back to the dashboard and click on the "Layout" tab.
  • Click on the "Add a Gadget" button, and then select the "HTML/JavaScript" gadget from the list.

In the "Content" field, paste the following code:


<script>

  var postTitle = document.getElementsByTagName("h1")[0].innerHTML;

  var postUrl = document.URL;

  var postLinks = document.getElementsByTagName("a");

  for (var i = 0; i < postLinks.length; i++) {

    if (postLinks[i].innerHTML == postTitle) {

      postLinks[i].setAttribute("href", postUrl);

    }

  }

</script>

Click on the "Save" button to save the gadget, and then click on the "View Blog" button to view your blog and test the automatic internal links.

Note: You will need to add this gadget to each individual blog post in order for it to work. You can also customize the script to target specific elements on your page, such as headings or images, rather than just the post title.

THANKS FOR READING...

You have our undying gratitude for your visit!