Skip to main content

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:

{{#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:

<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:

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

It must be a ., not a #.

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

---
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