Templater Vorlage lässt sich nicht öffnen: Error

Things I have tried

Ich habe versucht diese Vorlage zu benutzen aber bekomme eine Fehlermeldung?
In der Video und der Beschreibung zu diesem Template sieht alles so einfach aus, aber ich bekomme es nicht zum laufen. Kann mir jemand erklären was ich falsch mache?

url: "<% tp.user.youtube('url', tp) %>"
aliases: ["<% tp.user.youtube('title', tp) %>"]
channel: "<% tp.user.youtube('channel', tp) %>"
published: <% tp.user.youtube('published', tp) %>
thumbnail: "<% tp.user.youtube('thumbnail', tp) %>"
keywords: [<% tp.user.youtube('keywordsQ', tp) %>]
duration: <% tp.user.youtube('duration', tp) %>

# <% tp.user.youtube('title', tp) %>

<% tp.user.youtube('description', tp) %>

Beim ausführen der Vorlage kommt:

Templater Error:
Template parsing error, aborting.
Check console for more information

In der Console ist aufgeführt:
Templater Error: Template parsing error,
tp.user. youtube is not a function
@ plugin: templater-obsidian:61

What I’m trying to do

1 Like

I hope you read english better than I write German, so here goes.

There are two errors I see in the code you’ve given. One error related to the quotes you’re using, and one error related to the installation of a youtube user function.

Regarding quote usage

Update: The following section was from before Rigmarole corrected the formatting, which had changed quotes into smart quotes.

Usage of quotes

In the code you’ve pasted you’re using smart quotes, like in ‘url’, in general whenever code is involved you need to use ordinary/straight quotes, so that this would look like: 'url'.

So if this is not a copy-paste thing, you need to replace the and the , with ' everywhere.

youtube user function

Have you installed this function properly? One way to see that is to go to Settings > Templater > User Script Functions, and there should be a header like “Detected ## User Script(s)”. And in the list below, you should see the tp.user.youtube script.

In my setup in this Sandbox vault, you can see I’ve got 4 user scripts, and they’re located in the _jsTemplater folder in my vault. If you can’t see your tp.user.youtube, you need to check that the folder is correct, and that you inside that folder have a youtube.js (not a youtube.js.md) file.

If you don’t have that file, you need to look through your video again, and install that youtube.js file in the correct folder. Note that by default, you wouldn’t see the .js files, so in the image below you’ll ordinarily see just the something.js file (which actually is a something.js.md file).

If you see something like the something.js, you will need to use a file explorer, go to this folder, and change the file extension, so that it is just .js (and not .js.md).

Finally, if neither of these suggestion helps, you need to link the video and description you’ve used, so some of us could possible see it, and make out what went wrong.

1 Like

I’ve edited your post to include three backticks ``` surrounding your code, otherwise it can’t be read correctly.

Did you also correct the quotes, @rigmarole ? Or was the insertion of smart quotes done by the forum software, somehow? (It kind of renders part of my answer invalid)

Smart quotes came from the forum auto-formatting. I just added the surrounding backticks.

Sorry, I feel like an idiot. I can’t get it to work? I have no idea what’s going on. Here is the link to github GitHub - basilioss/obsidian-scrapers: Get information from link for Obsidian

Let’s start with the basics: Which folder have you configured for your user functions in Templater? And which files can you see in there?

Finding the folder

Go to Settings > Templater > User Script Functions, and tell us the value of the Scripts files folder location.

In my case it’s _jsTemplater, but this is what you set it to, and can be whatever. It does refer to a folder within your vault.

So what do your setting say the script files folder is?

Which files do you have in that folder?

Are you on Windows or Mac? In either case, open a file explorer and locate the base folder of your vault, and then go into the script folder you found in the previous point. Which files do you see in this folder?

I’m on Mac, and my folder looks like this:

Here you can see that all files (except the last one) ends with .js, and they can also be glimpsed in the previous image as tp.user.bar, tp.user.decodeYearTag, and so on.

So what does your script folder look like?

Thanks @holroy,

That comment about ‘starting with basics’ led me to the source of a parsing error I was having.

Thanks so much!


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