banner
ZDawn

ZDawn

Do one thing at a time and do well.
tg_channel

Use the Templater plugin to move the MD file created by double linking to the appropriate folder.

Using the Templater plugin to automatically move files to the desired folder when creating files with double links

Preparation#

Configuration Process#

Configure the [[Templater]] Plugin Template#

  • Create a Templater template storage folder called templates
  • Create a template file in the template folder, and name it as Link for example
  • Write the following content in the template
  • The purpose of this template is that when I create a file with double links, if I add a W character at the end of the file name, the file will be moved to /Work/{filename}, and it will automatically remove the W character, so no need to worry.
  • If you want to have more control, I believe you can understand this simple control code and modify it automatically.
  • Please make sure that you have created the corresponding folder before moving the file!
	<%*
			let name = tp.file.title
			if (name.endsWith("W")) {
			   await tp.file.move("/Work/" + name.substring(0, name.length - 1));
			} else if (name.endsWith("B")) {
			   await tp.file.move("/Blog/" + name.substring(0, name.length - 1));
			} else {
			}
	%> 

Configure the Plugin#

Please note my writing process. I use the current double-link diary flow to write.

  1. My folder organization structure is as follows
Journal-Default entry for diaries
Blog-Folder for sharing
Notes-Default folder for notes, **default folder for double-link creation**
Work-Work record folder
templates-Template folder
  1. Set the editor - Save the folder created with double links in Notes
    4oEROc3FBedWwmr.png
  2. Configure the Templater plugin - Folder Templates project
    1. Create a new project, automatically use the Link template when creating a document in Notes, configure as shown in the figure
      ex3JFU6nGlD5skV.png

Enjoy#

Now you can move documents according to the rules when creating documents with double links anywhere.
For example, according to my rule:
When I create a Obsidian使用心得B with double links, this document will be moved to the Blog folder and named Obsidian使用心得, isn't it nice!

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.