Introduction Background#
Those familiar with Ajian should know that Ajian uses Obsidian to record blogs. It is well known that Obsidian is a highly playable note-taking software, but Ajian does not like to tinker, so he tries to use the original functions provided by Obsidian as much as possible. However, recently when writing blogs, he always checks which week it is, which is a bit inconvenient. Therefore, he made a simple tweak by adding the week number in the YAML of the template file. This way, it will be easier to write weekly reviews (although I don't know if tweaking has made efficiency higher, it can be considered as a starting point). The automatic week number is implemented through the Templater plugin, and the code is shared below without the need for additional JavaScript functions.
Solution#
- Fix the location for creating new notes.
Click on "Settings-Files and Links-Store new note files in" - Install Templater and set up the Templater template
---
title: <% tp.file.title %>
date: <% tp.file.creation_date("YYYY-MM-DD") %>
tags:
week: <% tp.date.now("W") %>
---
My template is relatively simple, and you can modify it according to your own needs.
title
automatically gets the file title, which will be used when publishing xlogs, and should also be used when publishing from obsidian
to hugo
.
date
is the file creation date.
week
is the week number at the time of file creation, so there is a small bug. Writing a weekly review must be done within the current week, otherwise, the week number will be incorrect, which can be seen as a way to encourage timely writing of reviews.
- Use Templater to configure YAML format in specific directories.
Use specific templates in specific folders, because I have set it as the root directory of my notes, which automatically applies the template for all new note creations~