---
title: "Tags"
url: https://www.marlasowards.com/samples/contributor-guide/admin/46-tags
description: "How to add a tag element to selected pages through the docs site template, a feature that isn't styled or used yet."
author: Writing sample by Marla Sowards
---

> For an index of every page on this site, see [llms.txt](https://www.marlasowards.com/llms.txt).

> **Note:** I built this project for an enterprise SaaS company. However, what I've shared is genericized to mask proprietary information, including names of companies, products, features, and UI controls. Product images are mockups generated by Claude.

# Tags

> **Caution**
>
> This is not styled or implemented anywhere.

This article and the status bar callouts reference add an element to selected pages.

In **\_master.tmpl** (site-theme repo > **src/clearpath-docfx-template/templates/clearpath/layout/\_master.tmpl**), add:

```handlebars
{{#if tag}}
{{^_disableTag}}
{{>partials/tag}}
{{/_disableTag}}
{{/if}}
```

The `if` prevents the tag from showing on all pages. It shows only on pages with a `tag` in the YAML header.

In **partials** (site-theme repo > **src/clearpath-docfx-template/templates/clearpath/partials**), create **tag.tmpl.partial**.

Add the following in the new file:

```html
<div id="tag">
  {{#tag}}{{tag}}{{/tag}}
</div>
```

In **main.css** (site-theme repo > **src/clearpath-docfx-template/templates/clearpath/styles/main.css**), add and style the CSS:

```css
.tag {
  border: 10px;
  color: purple;
}
```

It must be a `.`, not a `#`.

In any article, add a `tag` to the YAML heading:

```yaml
---
uid: title.md
title: Title
tag: abc
---
```

In the built site, the styled tag shows at the top of the article. Change its order in **\_master.tmpl** to move it to a different place on the page.

## Reference

[Using tags in DocFx Markdown frontmatter YAML header](https://stackoverflow.com/questions/61559111/using-tags-in-docfx-markdown-frontmatter-yaml-header)
