1

Hugo 「近期」短代码(基于 Doumark Actions)

 1 year ago
source link: https://immmmm.com/hugo-shortcodes-recently-by-douban/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Hugo 「近期」短代码(基于 Doumark Actions)

1 天前 / 0 阅读

观影和阅读记录页面,无论用什么博客程序,总会想办法找 API 造轮子来实现。目前使用的是 Douban sync for GitHub Actions 方法,它会自动把 “豆瓣观影 / 阅读 / 音乐记录同步” 存为本地文件,安逸!

既然本地已经有一份自己的观影和阅读数据文件 data/douban/movie.csvdata/douban/book.csv ,除了做成两个页面,这些数据还能怎么用呢?

近期一直盯着 getJSON 函数和 Hugo 短代码做文章,那,继续折腾呗!

与完整记录页面的区别是,做成了短代码形式,同时限制了数量,方便文章中调用,比如在「关于」页面中展示。

  • 部署 豆瓣书影音同步 GitHub Action
  • books.htmlmovies.html 另存为 html 之后丢入主题 /layouts/shortcodes/ 内;
  • 调用代码如下,默认是 4 条数据。当然,也可手动指定,在短代码里加上数字(注意:直接数字,无引号):
\{\{< movies >\}\}
\{\{< books >\}\}
\{\{< movies 8>\}\}
\{\{< books 8>\}\}

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK