Add tags to articles
Last Update: Oct 2024 • Est. Read Time: 3 MINYou can tag articles with unique labels that help you organize your knowledge base and link related articles together, providing another way to connect articles that live across multiple categories. Tags, along with the article title and body, help customers search your knowledge base to find the most relevant results. Once a public article is published, the tags will be displayed as a tag cloud on the left side of the article, and selecting a tag will display all of the articles that are using it.
Who can access this feature? | |
User types | Content administrators can access knowledge base settings. |
If using tags in an internal article, you can find related articles by searching for the tag in the internal knowledge base.
Notes:
- If you created your knowledge base using an older default theme (before February 2021), you will need to add the tag template to your theme so that the tag cloud appears in your articles. For more information, see Add the tag cloud template to your existing theme.
- The tag cloud is only available for public articles.
In this article
Add tags to articles
When creating tags, keep the following guidelines in mind:
- You cannot have duplicate tags.
- When creating tags, they are case-sensitive. However, case sensitivity does not apply when searching for tags in the knowledge base.
- Tags are directly linked to article versions. If you restore an older version of your article, the tags will change.
- You cannot specify tags by brand. Any tags applied to an article will appear across all of the brands where the article resides.
To add a tag to an article:
- Select the article you wish to tag.
- Select Create a New Draft.
- In the Article Details pane, enter the name of your tag in the Tags box. If the tag already exists, you can select it from the menu that opens.
- If the tag doesn't exist, select Create Tag in the menu to add the tag to your system.
Note: You can add up to 20 tags to an article.
- Once you are done adding your tags, select Publish to save your changes. The tags will appear in a tag cloud at the bottom of your publicly published article.
Selecting a tag in your published article will open a list of all of the related articles that are using the same tag.
If you have an existing Knowledge Base, see Add the tag cloud template to your existing theme.
To remove a tag from an article:
- Open the article that contains the tag you want to remove.
- Select the X for each tag you want to remove.
- Select Publish to save your changes.
Note: Deleting a tag will only delete it from the current article.
Add the tag cloud template to your existing theme
If you created your knowledge base using the older default theme available before templates, you need to add the tag template to your theme for the tag cloud to display properly. If you created your theme using the Midtown theme as the default, the tags.jsx file is already included and you can skip these steps.
To add the template to your theme:
- Go to Settings
> Knowledge Base > Themes.
- Select Edit
for the theme your Knowledge Base is using.
- Select the article.jsx file in the Theme Files panel.
- Copy and paste the following tag block into the article.jsx file:
<div className="tag-wrap"> {(article.tags && article.tags.length > 0) && <div className="tag-text">Tags: </div>} {article.tags && article.tags.map(tag => <div key={tag.id} className="tag"> <a href={`/tags/${tag.name}`}>{tag.name}</a></div>)} </div>
Tip: The block can be added anywhere in the file as long as it is wrapped inside the <article> block. We recommend placing it after the separator-wrap block. - Select Save.
- Select Add New.
The Create Theme File dialog box opens. - Select the following options:
- Page from the Theme Target drop-down menu.
- Tag from the Page Type drop-down menu.
- Select Create.
- Copy and paste the following tag template in to the new file:
<main className="main-layout"> <Nav settings={org.settings} /> <HeroImage small /> <section className="container-search"> <div className="search-wrap search-results-header search-sml-wrap"> <div className="search-results-left"> <span className="search-results-number">{results.length} results</span> for '{tag}' </div> </div> <section className="container-article"> {!results.length && <div className="no-results-copy">No results</div>} {!!results.length && results.map(el => <ArticleItem key={el.title} {...el} publishedAt={el.publishedAt} />)} </section> </section> </main>
- Select Save. Tag clouds will now appear in your articles.