Advertisement
Guest User

Untitled

a guest
Nov 26th, 2024
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. <%*
  2. const file = tp.file.find_tfile(tp.file.title);
  3.  
  4. await app.fileManager.processFrontMatter(file, (frontmatter) => {
  5. // Replace "created" with the key you use
  6. if (!frontmatter["created"]) {
  7. frontmatter["created"] = tp.file.creation_date("YYYY-MM-DD HH:mm:ss")};
  8. });
  9.  
  10. await app.fileManager.processFrontMatter(file, (frontmatter) => {
  11. // Replace "updated" with the key you use
  12. frontmatter["updated"] = tp.date.now("YYYY-MM-DD HH:mm:ss");
  13. });
  14.  
  15. await app.fileManager.processFrontMatter(file, (frontmatter) => {
  16. // Replace "count" with the key you use
  17. if (frontmatter["viewCount"]) {
  18. frontmatter["viewCount"]++}
  19. else {
  20. frontmatter["viewCount"] = 1}
  21. });
  22. -%>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement