74 lines
2.1 KiB
Markdown
74 lines
2.1 KiB
Markdown
# Note Tagging & SEO Automation
|
|
|
|
Automatically tag your Obsidian notes and add SEO metadata using a local LLM.
|
|
|
|
## Setup
|
|
|
|
1. **Install dependencies:**
|
|
```bash
|
|
pip install pyyaml requests
|
|
```
|
|
|
|
2. **Make sure LM Studio is running** on `http://192.168.68.84:1234` with the `openai/gpt-oss-20b` model loaded
|
|
|
|
3. **Place these files in a directory:**
|
|
- `tag-notes.py` (the main script)
|
|
- `tag-taxonomy.yaml` (your tag taxonomy)
|
|
|
|
## Usage
|
|
|
|
Simply run the script:
|
|
```bash
|
|
./tag-notes.py
|
|
```
|
|
|
|
It will automatically process all markdown files in:
|
|
`~/Documents/ejl-zk/40 Public/41 Notes/`
|
|
|
|
To change the folder, edit the `NOTES_FOLDER` variable at the top of `tag-notes.py`.
|
|
|
|
## What it does
|
|
|
|
The script will:
|
|
- ✓ Add tags (1-5) using your taxonomy + 1-2 new suggestions
|
|
- ✓ Add SEO title (clean, non-clickbaity)
|
|
- ✓ Add SEO description (150-160 chars, factual)
|
|
- ✓ Add SEO keywords (generous, 10-15 keywords)
|
|
- ✓ **Only updates empty fields** - preserves existing values
|
|
- ✓ Updates files directly (no confirmation needed)
|
|
- ✓ **Only touches**: `tags`, `seo-title`, `seo-description`, `seo-keywords`
|
|
- ✓ **Preserves everything else** in your frontmatter
|
|
|
|
## Managing the taxonomy
|
|
|
|
Edit `tag-taxonomy.yaml` to add new tags that the LLM suggests and you like.
|
|
|
|
The LLM will:
|
|
- Prefer existing taxonomy tags
|
|
- Suggest 1-2 new tags if the content warrants it
|
|
- Be conservative with new tag suggestions
|
|
|
|
## Example output
|
|
|
|
```
|
|
Processing: /path/to/note.md
|
|
+ Added tags: self-hosting, linux, docker
|
|
(New suggestions: containers)
|
|
+ Added SEO title: Setting Up a Self-Hosted Development Environment
|
|
+ Added SEO description
|
|
+ Added 12 SEO keywords
|
|
✓ Updated successfully
|
|
```
|
|
|
|
## Troubleshooting
|
|
|
|
**LLM connection errors:**
|
|
- Check that LM Studio is running: `curl http://192.168.68.84:1234/v1/models`
|
|
- Verify the model is loaded in LM Studio
|
|
|
|
**No frontmatter found:**
|
|
- The note needs YAML frontmatter between `---` delimiters
|
|
|
|
**Fields already populated:**
|
|
- Script skips notes where all four fields are already filled
|
|
- To re-process a note, clear the specific fields you want regenerated |