Templater Syntax

I am attempting to do the following say I have my note title as +Project 1, I want to hard code into my Project Template an Alias that is just Project 1 (without the +)

I am trying to use tp.file.title and then remove the first character.

Any help in doing this would be great.

<%*+ tR += tp.file.title.slice(1) %>

(remove the + after <%* if using it in a template)

This is what I have


Tags: :gear:
Aliases:

  • <% tR += tp.file.title.slice(1) %>

Type: Utility / System
Status: In Progress
Title: <% tp.file.title %>
Creation Date: <% tp.date.now(yyyy-mm-dd) %>

<% tp.file.title %>

When I try applying the template it says Template Parsing error, aborting.

In tp.date.now(yyyy-mm-dd), the format must be a string. Upper-/lowercase also matters. Try

<% tp.date.now("YYYY-MM-DD") %>

Also please put code parts for the forums in code blocks, like

```
code goes here
```

Got it to work thanks a bunch. Is there a resource that would help with this, their online documentation said nothing about a slice command

You’re welcome. If you will, mark a solution so others know this has been solved.

The .slice() is just pure Javascript. You’ll find a lot of usable functions in the online Javascript docs (there are so many, like MDN or W3C).

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