omnivore-app / obsidian-omnivore

Obsidian plugin to fetch articles and highlights from Omnivore
MIT License
726 stars 39 forks source link

I want to add the article yearwise? #164

Open pakosaan opened 7 months ago

pakosaan commented 7 months ago

Omnivore/Articles/{{{date:YYYY}}}

I wanted Omnivore/Articles/2023/

sywhb commented 7 months ago
Screenshot 2023-12-08 at 3 28 33 PM

Hey @pakosaan , you can custom the data format of the date variable in the folder name in the plugin settings

pressdarling commented 2 months ago

This took far too long for me to find this out - I was getting quite frustrated by the differences in Moment.js parsing between this and Templater. This seems to work, in case it's useful for anybody else - @sywhb I suggest adding a link to this in the docs and/or inline in settings: https://moment.github.io/luxon/#/formatting?id=table-of-tokens

This allowed me to get this example:

{{#formatDate}}{{dateSaved}},"yyyy-MM-dd kkkk/'W'WW yyyy/MM yyyy/'Q'q yyyy"{{/formatDate}}

Which is equivalent to this Templater syntax using the (in standard Moment format):

<% tp.file.creation_date("YYYY-MM-DD GGGG/[W]WW YYYY/MM YYYY/[Q]Q YYYY") %>

To come out as this across both my mustachio'd Omnivore templates as well as my clean-shaven Templater template frontmatter:

2024-04-22 2024/W17 2024/04 2024/Q2 2024