Take the first X letters out of the title as a Tag

Hello there,

is it possible to tell Obsidian, that the first X letters out of the title from a note, also created as a tag in the note itself?

E.g.: The title of the note is like “1040, 10 XXX - XXX” and in the note I write in the first line the tags. In this case “#1040BF” and some more …
Something lile #{{4:Title}}BF or so …

I create the notes with the QuickAdd PlugInn.

Thanks :smiley:

I’ve never used QuickAdd, but I recently started using Templater, and it does offer possibilities to insert stuff all over your file, and it would indeed be possible to use Templater to insert a tag based upon your file title.

So I would research Templater, and look into using a template for your new files, which then would insert the needed tags.


You may want to consider Dataview plugin

`= this.file.name`

That should give filename, But I dont know how to trim off un-needed characters.

First of all Thanks!

I tried Templater now and maybe it could solve my problem …

The thing is:
The title of my template looks like “01 Firun - nameofNewspaper” (so I got one template for NewpaperA (01 Firun - NewpaperA) and another for NewpaperB (01 - Firun - NewspaperB) because depending on the newspaper there will be other tags in the note) but when I create a note with QuickAdd I could say, that Obsidian ask me for the note title and there I wrote “{{MVALUE}}, 01 Firun - {{VALUE}}”.
So I press ctrl+p and then choose the template I need (depending on the “month” (01 Firun) and the newspaper, in which the article is). After that I can copy&paste the tile ({{VALUE}}) and the year ({{MVALUE}}).

The title after that looks like:
1041, 01 Firun - awesome title
and in the note there will be a tag for the Newspaper

With <% tp.file.title.split(" ")[2] %> I could say, that in the note will be the 2nd word out of the title … BUT from the template. So … very close!! Maybe I need to fit all of my templates now to the new Plugin :thinking: but not sure …

Apologies for my bad english :S.

It works!!! I just need to insert
<% tp.file.title.split(" ")[0] %>

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.