A website can become like a massive textbook of information over the years as content is added. Pages are added every week and month, connected with navigation and keywords, covering a breadth of topics. But what happens when a lateral concept or keyword needs to be updated across many pages of the website?
Unless someone on the content team has a rolodex memory of all the pages and information on the site it can be a tedious task to track down all the uses of a certain word. Here are some reasons why your organization might need to find all instances of a word:
Here are some reasons why your organization might need to find all instances of a word:
- The mission has changed: A focus area or program has ended and the website needs to be updated to reflect that.
- A word is outdated: The term “disabled” is now seen as negative and should be changed to “differently abled” or “person with a disability” across all uses on the site.
- A change in staff: A staff member responsible for a certain area of the website has left, and their name needs to be removed from the site.
- A new project: A specific campaign or project is launching and targeted landing pages need to be created. There might be template pages that need slight alteration for the new project.
- An additional resource like calling 988 for mental health emergencies needs to be added to previous resources on the site.
In these cases, it would be helpful to have a tool that would help content editors do a search for a keyword or phrase and compile all of the results in one place.
1. Use Google Site Search | site:{domain} {keyword}
Using Google Site Search operator by putting “site:{yourdomain} {keywords}” to return the pages that contain those words based on indexed pages. More about how to use this Site Search operator.
Try enabling the “verbatim” option to give more specific results around a keyword. Exporting this as a list can be tedious so we recommend using an SEO tool to export the list with a plugin like SEO Quake or find another result scraping tool.
2. Use the Internal Site /Search
Find the search bar of the site or just try putting “/search” on the domain and then enter the keyword you’re looking for. The success of this tactic will vary depending on the type of site search engine the site uses and in our experience the Google Site Search option is a more reliable approach.
3. Use SEO Tool Screaming Frog
SEO tools are all about finding and using keywords and Screaming Frog is a super helpful tool for crawling websites. This tool can also be used to find specific keywords with the custom search option. For larger sites over a few hundred pages it may require a purchase.
4. Use Google Spreadsheet + ImportXML
Get a list of your site’s urls from the sitemap.xml or your Google Analytics report. Use the function =ImportXML({URL},{Xpath}) details about using import XML. To make the output a little cleaner into one cell try =join(char(10),IMPORTXML(A2,”//body”)) -> this assumes you have put the URL in cell A2.
So, when you use this formula in a cell, it will:
- Fetch the webpage specified by the URL in cell A3.
- Extract all the content within the
<body>tag of the webpage using the XPath query"//body". - Join the extracted elements into a single string, separating each element with a line break character.
- Display the resulting string in the cell where the formula is entered.
For example, if cell A2 contains the URL “https://www.example.com“, the formula will retrieve the content of the <body> tag from that webpage, and display it in the cell with each element separated by a line break.
Note: The IMPORTXML function requires an active internet connection to fetch the webpage data. Additionally, the webpage must allow web scraping and not have any restrictions or barriers in place that prevent accessing its content.
Once you have all the body content of your site you can quickly do a search or create filters that pull the keywords you’re looking for. Bonus is that you can use GPT in Spreadsheets to rewrite your content 😉
5. Download the Site and Grep Search (Very Techincal)
This type of search is called a “Grep Search” (Global Regular Expression Print). It allows you to not only search for an exact word but also pull up partial matches, alternate spellings, and misspellings of your target word across all files on your server without having to open each individually.
Grep is available on both Mac and PC operating systems but Workshare disorders it slightly differently. Here are step-by-step instructions on how to do a Grep Search using both Mac Terminal and Windows Command Prompt:
How To Use Grep Search
Mac Terminal:
1) Open Terminal
2) Type in “grep” followed by single quotes ‘example’ (without the quotation marks around example) The single quotes are important because it searches for the literal characters rather than anything that might start with those letters such as examples or inexact
3) After example, within the same single quote marks add a space then -r This tells grep to do a recursive search
4) Add a space again and then type in the path to the folder you want to search. This will be different for everyone based on file structure. An example might look like this: /Users/USERNAME/Documents/FolderName
5) To tell grep what file type to look for, add another space and then *.(file extension). For example, *.(html) if you want to only look through pages with the .html extension
6) Press enter
Grep will start searching through all files in that directory and return a list of every instance the word appears including the file name and line number.
Windows Command Prompt:
1) Open Command Prompt by hitting the Windows key + R on your keyboard and then typing in cmd
2) Type in “grep” followed by a single quote ‘example’ (without the quotation marks around example) The single quotes are important because it searches for the literal characters rather than anything that might start with those letters such as examples or inexact
3) After example, within the same double quote marks add a space then -r This tells grep to do a recursive search4) Add a space again and then type in the path to the folder you want to search. This will be different for everyone based on file structure. An example might look like this: C:\Users\USERNAME\Documents\FolderName\*.* The *.* searches all files regardless of extension
5) Press enter
Grep will start searching through all files in that directory and return a list of every instance the word that appears including the file name and line number.
There are a variety of ways that you can search for specific keywords across a website. The method that will work best for you will depend on the size of your website and your level of technical expertise. We recommend starting with the Google Site Search operator and if you have a large website or need more specific results, moving on to the Screaming Frog SEO tool.