Hi! In this article I’ll show you how you can automate the creation of a weight chart based on the notes in a folder — using the Templater plugin and charts-obsidian.


🚀 What we’ll do

  • Automatically gather data from a folder with a YAML field Weight: 72
  • Generate a Markdown table with dates and weights
  • Create a chart based on this data
  • All of it — with one click via a template

🤔 Why we use Templater instead of “Templates

What you need to doUse
Just substitute a date, title, linkTemplates (built-in)
Insert a fixed text templateTemplates (built-in)
Use logic (if/else, loops, sorting)Templater
Pull YAML fields from other filesTemplater
Automatically build tables from foldersTemplater
Insert the current date in YYYY-MM-DD formatEither one
Run JavaScript codeTemplater
Automatically run a template when a file opensTemplater

If you use if, for, tp.file or tp.web

— it’s Templater.

If you just insert {{date}},

it’s the built-in Templates.


🧩 Installing the Templater plugin

  1. Open Settings → Community plugins
  2. Click Browse and find Templater
  3. Install and activate

📍 Then go to Settings → Templater:

  • 📁 Specify the Template folder location (e.g. .templates)

  • ✅ Enable Trigger Templater on file open if you want it to run automatically when a file opens

📸


🧠 What is Templater?

Templater is a powerful templating language that lets you:

  • Insert variables (date, file name, YAML data)
  • Run JavaScript right in the template
  • Automate routine tasks

✨ An example of a simple template:

📸

---
Created: 2025-05-14 12:27
Modified: 14.05.2025 01:29
---
 
# Templater

📸 After applying the template:


📦 The project structure for the weights example

📸 The weights folder should be like this:

📸 Each note should have a YAML block with the weight:


🛠 The template: an automatic table + chart

Create a template at .templates/weight_chart.md and paste this code into it:

| Month | Weight |
|-------|--------|

^weight

```chart
type: line
id: weight
x: Month
y: Weight

---

## ✅ How to insert the template

1. Open the note where you want to see the chart
2. Insert the template:
   - `Ctrl + P → Templater: Insert Template`
   - Or set up a hotkey (e.g. `Ctrl+Alt+W`)

>[!quote] 📸 
> 
>![[Pasted image 20250508165511.png]]

---

## 🔄 How to update the chart

>[!example] Added a new note with a weight?
> 
> The table and chart **won't update automatically**.

>[!todo] To update it:
> 
>- [ ] Just insert the template again — it **rescans the folder and redraws** the chart
>- [ ] I recommend setting up a hotkey to do this **in one press**

---

## 💡 Possibilities for expansion

You can:

- Automate inserting the template when a file opens (via `Trigger Templater`)
- Substitute the current month/year
- Add other fields, like `Fat`, `Measurements`, `Mood` — anything you have in your YAML

---

## 🖼 The final result

>[!quote] ![[йуйцуйуйц.png]]
> 

---

## 🧷 Conclusion

Templater is a genuinely powerful tool. It helps you get rid of the routine, especially if you:

- Keep trackers
- Fill in templates by hand
- Work with repeating formats