• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
JavaScriptSource

JavaScriptSource

Search 5,000+ Free JavaScript Snippets

  • Home
  • Browse Snippets
    • Addon
    • Ajax
    • Buttons
    • Cookies
    • CSS
    • Featured
    • Forms
    • Games
    • Generators
    • Image Effects
    • Math Related
    • Miscellaneous
    • Multimedia
    • Navigation
    • Page Details
    • Passwords
    • Text Effects
    • Time & Date
    • User Details
Home / Generators / Robots Text Generator

Robots Text Generator

Robots Text Generator

This generator creates the meta tag for robots. It also includes the code for the Googlebot.

<!– Paste this code into the CSS section of your HTML document  –>

.table1 {
  border: solid .05em;
  padding: .5em;
}
<!– Paste this code into an external JavaScript file named: roboTxt.js  –>

/* This script and many more are available free online at
The JavaScript Source :: http://javascriptsource.com
Created by: Lee Underwood :: http://javascriptsource.com/ */

function createRobotTag() {
  var robotsTag=”<meta name=”robots” content “”;

  if (document.getElementById(“none”).checked) {
    robotsTag += “none”>”;
    document.getElementById(“index”).disabled=true;
    document.getElementById(“follow”).disabled=true;
  } else if (document.getElementById(“none”).checked==false) {
    document.getElementById(“index”).disabled=false;
    document.getElementById(“follow”).disabled=false;
    if (document.getElementById(“index”).checked) {
      robotsTag += “noindex, “;
    } else {
      robotsTag += “index, “;
    }
    if(document.getElementById(“follow”).checked) {
      robotsTag += “nofollow”>”;
    } else {
      robotsTag += “follow”>”;
    }
  }
  document.getElementById(“tag”).value = robotsTag;
}

function googTag() {
  var googleTag=”<meta name=”Googlebot” content=”nofollow”>”;
  if (document.getElementById(“googleBot”).checked) {
    document.getElementById(“tag2”).value = googleTag;
  } else {
    document.getElementById(“tag2”).value = “”;
  }
}

function copyToClipboard() {
  document.getElementById(“tag”).focus();
  document.getElementById(“tag”).select();
  copiedTxt=document.selection.createRange();
  copiedTxt.execCommand(“Copy”);
}

function copyToClipboard2() {
  document.getElementById(“tag2”).focus();
  document.getElementById(“tag2”).select();
  copiedTxt2=document.selection.createRange();
  copiedTxt2.execCommand(“Copy”);
}
<!– Paste this code into the HEAD section of your HTML document.
     You may need to change the path of the file.  –>

<script type=”text/javascript” src=”roboTxt.js”></script>
<!– Paste this code into the BODY section of your HTML document  –>

<table width=”60%” align=”center” class=”table1″>
<tr><td>
<form>
<input type=”checkbox” id=”none” onclick=”createRobotTag()”> <strong>Tell robots to ignore this page</strong>
<br>
<input type=”checkbox” id=”index” onclick=”createRobotTag()”> <strong>Tell robots to not index this page in the search engines</strong>
<br>
<input type=”checkbox” id=”follow” onclick=”createRobotTag()”> <strong>Tell robots to not follow any of the links on this page</strong>
<p>
Insert this meta tag in the <head> section of your Web page:<br>
<input type=”text” size=”50″ id=”tag” readonly><br>
<input type=”button” onClick=”copyToClipboard()” value=”Copy to clipboard”><br><small>[<em>Netscape, Firefox, and Opera users – Press button to select and  [Ctrl]+C to copy</em>]</small>
<br><br><br>
<input type=”checkbox” id=”googleBot” onclick=”googTag()”> <strong>Tell only the Googlebot to ignore this page</strong>
<p>
Insert this meta tag in the <head> section of your Web page:<br>
<input type=”text” size=”50″ id=”tag2″ readonly><br>
<input type=”button” onClick=”copyToClipboard2()” value=”Copy to clipboard”><br><small>[<em>Netscape, Firefox, and Opera users – Press button to select and [Ctrl]+C to copy</em>]</small>
</form>
</td></tr>
</table>
<p><div align=”center”>
<font face=”arial, helvetica” size”-2″>Free JavaScripts provided<br>
by <a href=”https://javascriptsource.com”>The JavaScript Source</a></font>
</div><p>

Generators

Related Snippets:

  • DHTML Tooltip Generator 3
  • Story Generator
  • Linear Equation Generator
  • Flashing Scrollbar Maker

Primary Sidebar

Popular Posts

Story Generator

IP Grabber – get a users IP address with JavaScript

Simple Calendar

Remove Ads

Astrological Calculator

Copyright © 2025 JavaScriptSource.com

  • About
  • Privacy Policy
  • FAQ
  • Jobs For Developers