Tags
Tags provide flexible categorization and organization for your notes beyond wikilinks and folders.
Creating Tags
Section titled “Creating Tags”Inline Tags
Section titled “Inline Tags”Add tags directly in note content:
# Machine Learning Fundamentals
This covers basic algorithms and applications.
#machine-learning #data-science #algorithms #beginnerFront Matter Tags
Section titled “Front Matter Tags”Add tags in YAML front matter:
---tags: [machine-learning, data-science, algorithms, beginner]---Hierarchical Tags
Section titled “Hierarchical Tags”Create tag hierarchies using forward slashes:
#programming/frameworks/react#work/projects/website-redesign#personal/health/exerciseAutocompletion
Section titled “Autocompletion”Typing # shows existing tags. In front matter, use Ctrl+Space for tag suggestions.
Tag Explorer
Section titled “Tag Explorer”Use the Tag Explorer panel in VS Code’s sidebar to:
- Browse hierarchical tag structure
- Filter by tag names
- Click tags to see all associated notes
- View tag usage counts
- Search for tags (click the search icon or use “Foam: Search Tag” command)
Tags also appear in the Graph Visualization with customizable colors.
Tag Search
Section titled “Tag Search”Search for all occurrences of a tag across your workspace:
- Use the command palette: “Foam: Search Tag”
- Or click the search icon next to a tag in the Tag Explorer panel
Results appear in VS Code’s search panel where you can navigate between matches.
Known limitation: this command leverages VS Code’s search capability, so it’s constrained by its use of regular expressions. The search is best-effort and some false search results might show up.
Custom Tag Styling
Section titled “Custom Tag Styling”Customize tag appearance in markdown preview by adding CSS:
- Create
.foam/css/custom-tag-style.css - Add CSS targeting
.foam-tagclass:.foam-tag {color: #ffffff;background-color: #000000;} - Update
.vscode/settings.json:{"markdown.styles": [".foam/css/custom-tag-style.css"]}
Tags vs Backlinks
Section titled “Tags vs Backlinks”Some users prefer [[book]] backlinks instead of #book tags for categorization. Both approaches work - choose what fits your workflow.