SEO Code & Search Operators
Operators:
site:
Searches a specific site on the web. You can use this to check if a page is indexed by search engines, and you can also refine this search to find specific pages within the site that contain a certain keyword.
i.e.
site:youtube.com cat videos
If you want to exclude keywords from your search, preface them with a “-”
i.e.
site:youtube.com
jaguar speed -car
This is likely the most common search operator you will use.
Full list of currently supported operators from Ahrefs:
Search operator | What it does | Example |
---|---|---|
| Search for results that mention a word or phrase. | |
| Search for results related to X or Y. | |
| Same as | |
| Search for results related to X and Y. | |
| Search for results that don’t mention a word or phrase. | |
| Wildcard matching any word or phrase. | |
| Group multiple searches. | |
| Search for the definition of a word or phrase. | |
| Find the most recent cache of a webpage. | |
| Search for particular types of files (e.g., PDF). | |
| Same as | |
| Search for results from a particular website. | |
| Search for sites related to a given domain. | |
| Search for pages with a particular word in the title tag. | |
| Search for pages with multiple words in the title tag. | |
| Search for pages with a particular word in the URL. | |
| Search for pages with multiple words in the URL. | |
| Search for pages with a particular word in their content. | |
| Search for pages with multiple words in their content. | |
| Search for the weather in a location. | |
| Search for stock information for a ticker. | |
| Force Google to show map results. | |
| Search for information about a movie. | |
| Convert one unit to another. | |
| Search for results from a particular source in Google News. | |
| Search for results from before a particular date. | |
| Search for results from after a particular date. |
Console Commands
To allow for browser console commands, type in “allow pasting” and press enter to allow custom console commands in Chrome inspect.
Finding total amount of Script tags on a page
const scriptTags = document.querySelectorAll('script');
scriptTags.length
Finding the total amount of DOM elements.
document.getElementsByTagName('*').length