Skip to content

Commit

Permalink
add fetched timestamp to frontmatter (#28)
Browse files Browse the repository at this point in the history
  • Loading branch information
kbravh committed Jul 3, 2022
1 parent 804ecdc commit ffd1337
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "obsidian-tweet-to-markdown",
"name": "Tweet to Markdown",
"version": "2.7.1",
"version": "2.8.0",
"minAppVersion": "0.12.17",
"description": "Save tweets as Markdown files, along with their images, polls, etc.",
"author": "kbravh",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "obsidian-tweet-to-markdown",
"version": "2.7.1",
"version": "2.8.0",
"description": "Save tweets as beautiful markdown files in Obsidian (https://obsidian.md)",
"main": "main.js",
"engines": {
Expand Down
5 changes: 5 additions & 0 deletions src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -360,13 +360,18 @@ export const buildMarkdown = async (
*/
const frontmatter = []
if (plugin.settings.frontmatter) {
const fetchedAt = formatTimestamp(new Date().toString(), {
locale: plugin.settings.dateLocale,
format: plugin.settings.dateFormat,
})
frontmatter.push(
...[
'---',
`author: "${user.name}"`,
`handle: "@${user.username}"`,
`source: "https://twitter.com/${user.username}/status/${tweet.data.id}"`,
`date: "${date}"`,
`fetched: "${fetchedAt}"`,
...metrics,
]
)
Expand Down
2 changes: 1 addition & 1 deletion versions.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"2.7.1": "0.12.17"
"2.8.0": "0.12.17"
}

0 comments on commit ffd1337

Please sign in to comment.