Trying to create one Wiki folder for a broad topic, such as my food folder. With many various types and thus specific properties, it means I have to create a template for each type.
Proposed solution
Have IF/THEN solutions with properties.
When choosing a specific property or click a property checkbox, have one or a set of preconfigured properties shown below. This way I can just use one and the same template for many different types of notes in one wiki vault or folder. Having just one template also helps when reconfiguring, without having to look or change something in each separate template.
Example:
Lets say in my food wiki folder in the “FoodType” property, I choose “Dish”, it will automatically add specific properties such as:
DishType: e.g. Stew
Origin: e.g. Indonesia
Or I choose the type “Product” and I would get the properties:
Brand: e.g. Barilla
Rate: e.g. 3 star emoticons
Another way instead of having specific property choices, have a checkbox which would hide or show other properties.
So new notes in this food wiki would all start with the “FoodType” property. Depending on which food type you choose, a set of other properties would appear.
Current workaround (optional)
Creating a new preconfigured template for each “FoodType”.
Related feature requests (optional)
I couldn’t find anything specific to my problem.
You could design a Templater template to apply, which could automate the addition or deletion of properties. You could even write a JavaScript script / module to run with the RunJS plugin to achieve the same result.
The benefit of rolling out your solution is to avoid having several templates, which might need to be changed if the need arises, i.e., supports the DRY approach.
I’m not sure if I’m understanding correctly because you can use properties-templates, which are special type of templates documented in Properties - Obsidian Help. This way you can separate automatic properties generation from automatic content creation when creating notes. Use Advanced URI plugin + QuickAdd shortcuts to create notes using links. I’m not sure if there are easier options since combining two plugins to get note creation from templates using links sounds very basic use case.
You are on the right track regarding the “separation of concerns”. With your approach, you have:
to install two additional plugins if you are not already using them – I try to have as few plugins installed as possible, to minimise possible side-effects to manage,
to manage the properties’ templates if some or all change.
I already use the Templater plugin and am evaluating the RunJS plugin. Both allow you to run a JavaScript script to manipulate the frontmatter (YAML section).
The script is the only (read: one) place I need to go to add or remove logic for changing any property-related aspects; less wondering which property template I need to change and how.
Conclusion: If you already use Advanced URI and QuickAdd for other use cases stick with it. On the other hand, if you are using them only to achieve your management of properties in templates, I suggest rethinking your approach and using the tools you already have at hand or to minimise the plugins you are installing. Less is more.
Can you add more details about using Templater via link or button? I understand that you can use Templater to
run your script when the note is created
run scripts without creating notes using a command
What I’m looking for is note-specific command list, most easily implemented by links that come after the frontmatter (or you could put them to your frontmatter as text properties). When using command lists in notes, this way you get more customization what commands you want to use instead of using one command list for everything.
I’m not sure if Templater, QuickAdd or RunJS can make runnable code blocks but at least Execute Code does that. The core difference between all of these plugins might be different APIs that they provide to the user. But at least Execute Code offers interactive code blocks which means you include any code to your template and then run the code using a separate button at any time. Obviously you can do much more because you can get output after execution and you can use many programming languages with their own specialized libraries.
I think it’s not productive, but you could do the opposite as well and run any shell command using a command in Obsidian. See Shell Commands. It offers URI scheme so you get similar functionality with Advanced URI. Similarly we could think Templater, QuickAdd or RunJS implementing their own URI scheme. But Shell Commands can be very useful when you want to define global actions that are not tied to specific notes (I’m not sure if QuickAdd can do this).
That is not exactly how Templater works. Generally speaking, you are applying a template to the current note. If the template only contains execution commands and no Markdown or white spaces, then effectively, there will be no output added to your note.
I am trying to wrap my head around what you want. Do I understand correctly?:
You want to have links in your notes, under the fronmatter, that you can click or tap and a predefined set of properties are added or change existing ones.
The link generation depends on conditions, e.g., folder, specific property value etc.
What happens after you click or tap on the link? Do you want it to stay or “disappear”?
My approach would be to define a set of JavaScript rules and run the code with a shortcut, with Templater as a “template” to apply or with RunJS.
There is another plugin Run, which lets you execute JavaScript in the note when you save it: GitHub - HananoshikaYomaru/obsidian-run: Generate markdown from dataview query and javascript. – must be installed via BRAT. That way you could incorporate your logic in each template. You could use it as an alternative to Execute Code, which by the way only works in view mode if I am correct, or Code Emitter – has the same limitation as Execute Code.
Not anything fancy. Just have property templates (using QuickAdd etc) listed as clickable commands after the frontmatter. They just add missing properties and stays there normally when you click. You could have 5 different use cases, where the template for your note stays same but properties change. Obviously this is a static system in a sense, because adding new property commands requires a lot of work. Bookmarks make it easy to automate searches but we don’t have similar feature for adding templates. We could just have new parameter in Obsidian URI: template which automates search in Insert template pop up menu. This way we could do partial matching and making adding templates much more easier without using complex customization. I think we already have native feature to generate note url automatically (I tested in sandbox vault right clicking a note in Files view and there is copy Obsidian URL). We could have native urls management GUI similar to bookmarks where you can just click to execute, but we could also do something different and transform bookmarks to urls or vice versa. This way we don’t introduce new GUI elements and can manage Bookmarks and URLs using the same GUI. I haven’t posted this as feature request, because I’m still experimenting with my workflows. I’m not sure if I want to heavily rely on properties and they don’t work well anyways currently (search by date/boolean/number value doesn’t seem to work, but obviously this is going to change with planned “dynamic tables” feature. But still searching is very different compared to tables located in notes, because the search GUI stays on the left while tables disappear when your navigate between notes (though we have page preview which is really awesome, but pressing cmd is very common when editing and hence page preview adds unwanted visual flickering to your editing experience).