Generate and Visualize Keywords Using Chat GPT & Code PEN

In this article, we will show you how to generate keywords and visualize them in a tree map that resembles semantic relationships between the keywords.

In the example below, we want to produce a list of keywords around the topic of ‘cavity prevention’ (SEED KEYWORD) and have it depicted in a word map so we get a good visualization of the topical structure we want to optimize and produce content for.

1. Get the code for keyword visualization

First, head over to code pen and copy/paste the code used for keyword generation:

This visualization code is a Keyword Tree representation that can help us understand how a content map should look like in terms of its semantic entity relationships. By mapping it out, we can also figure out how to link internally and build a variety of pages covering separate topics.

Such an approach will inevitably lead to Topical authority of a singular subject.

The code was developed by Koray Tuğberk GÜBÜR.

2. Copy/Paste Code into GPT for modification

Grab the HTML script that runs in code pen:

Then go ahead and paste it into Chat GPT, adding the following instructions:

Just replace ‘cavity prevention’ with whatever keyword or topic you want to generate keywords and map out:

replace the words that are under [phrases] in this script with 50 keywords for ‘cavity prevention’ ranging from keyword variations of the seed keyword ‘cavity prevention’ to semantically related terms and long tail versions of the seed keyword.

Now Chat GPT will modify the code by replacing the topic, and adding 50 keywords around the topic of ‘cavity prevention.’

Wait for the Chat GPT output, which should look like this:

Now in order to have a branching tree, we need the first word in the [phrases] to be ‘cavity prevention. So, add a command in Chat GPT:

update the phrases so that they always begin with cavity prevention in a logical sense

And get the output, which should look like this now:

3. Update the Code in Codepen using the GPT-generated code

Copy/paste in the code from Chat GPT into the CodePen Function:

Hit ENTER, and get the following word tree displayed:

4. Examine the Word Tree relationships

Let’s dive into each of these sets of word branches as they’re all different and tell a holistic story about cavity prevention.

1. Cavity Prevention Through…

We have now a good idea of some of the methods used for cavity prevention.

For example: Cavity prevention through brushing teeth twice a day

This could be a really nice blog post, as well as a tik tok and youtube video. Very easy to make, literally, anyone can do it!

2. Cavity prevention By…

From these branches, we quickly see some of the best practices when it comes to:

  • avoiding what causes cavity prevention
  • understanding what cavity prevention is and what can make I worse
  • recognizing the basic symptoms and risks involved in cavity prevention

3. Cavity Prevention with…

From these word tree branches, we learn about the common tools and solutions that could employed to prevent cavity.

Examples would be:

  • xylitol
  • water containing fluoride
  • green tea

5. Create A Topical Map Plan

From here, you can now plan the Topical Map that will be a one-stop-shop for anyone who is curious about cavity prevention.

Topical maps are based on SEO entities that are interrelated via similar semantic connections as the keywords that Chat GPT just generated.

From the branching divisions displayed in the examples above, we can categorize cavity prevention into 3 sets of keywords (pages) or subtopics:

  1. causes of cavity prevention
  2. methods of cavity prevention
  3. tools for cavity prevention

1. Internal links between subtopics

Ideally, when writing a web page about ‘how sugary foods cause cavity prevention’ you would link to a web page that talks about ‘home remedies for cavity prevention’

As such, your linking structure is following a semantic order that is outlined with the branching of the word tree of the seed keyword ‘cavity prevention.’

2. Define What’s a topic, subtopic, and a single-page post

Based on the complexity of the topic, you may need it to break it down into subtopics (methods, causes, tools, etc.).

From there, each subtopic would be assigned a number of web pages, based on, e.g. the number of existing tools for treating cavity prevention.

Sometimes, the keyword search volume may be too small to write a single page about it. For example ‘home remedies for cavity prevention’ would be a single page discussing multiple solutions as these may not have enough volume to be each a separate page.


Višnja is a passionate digital marketing advocate that works with Aleph as an author, contributor, and consultant to our clients. She has a degree in psychology and a knack for content marketing.

Let's start
a new project


d :
h :
m :
Suggested Reads