Last active
November 14, 2023 08:37
-
-
Save emisjerry/38f074b40461707bcc5d3a0b6b822753 to your computer and use it in GitHub Desktop.
Obsidian Templater格式的一般筆記模板(副檔名應為.md)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
<%* | |
let title = tp.file.title; | |
if (title.startsWith("未命名")) { | |
title = await tp.system.prompt("新建筆記檔名", title); | |
if (!title) return; | |
} | |
if (title == "") { | |
title = "未命名"; | |
} else { | |
await tp.file.rename(title); | |
} | |
const aTags = ["blog", "yt-videos", "obsidian", "autohotkey", "windows"]; | |
let tag = await tp.system.suggester(aTags, aTags); | |
if (tag == "yt-videos") { | |
tag = "blog, yt-videos"; | |
} | |
let random_picture = await tp.web.random_picture("1600x900", title+","+tag); | |
-%> | |
created: <% tp.file.creation_date() %> | |
aliases: [ <% title %> ] | |
tags: [ <% tag %> ] | |
--- | |
# <% title %> | |
Modified:: <%+ tp.file.last_modified_date() %> | |
<% random_picture %> | |
<% tp.file.cursor(1) %> | |
## 相關連結 | |
<% tp.file.cursor(2) %> | |
<%* if (tag.contains("yt-videos")) { %> | |
## 教學影片 | |
<iframe width="650" height="315" src="https://www.youtube.com/embed/$$" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe> | |
<%* } %> | |
## |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
changes