diff options
author | Doge <[email protected]> | 2021-05-12 13:11:14 +0800 |
---|---|---|
committer | Doge <[email protected]> | 2021-05-12 13:11:14 +0800 |
commit | e49cd3cf87a241c9bdf8b0729c2a3446c119a1b5 (patch) | |
tree | 45bfb7e354f7f40c2e554f48951abc356dae42cc | |
parent | 0b49431daaf26a02b45ac694a95fbbdfae8141fb (diff) | |
download | chromate-e49cd3cf87a241c9bdf8b0729c2a3446c119a1b5.tar.gz chromate-e49cd3cf87a241c9bdf8b0729c2a3446c119a1b5.tar.bz2 chromate-e49cd3cf87a241c9bdf8b0729c2a3446c119a1b5.zip |
Add podcast meta rendering
-rw-r--r-- | languages/default.yml | 5 | ||||
-rw-r--r-- | languages/zh-cn.yml | 5 | ||||
-rw-r--r-- | layout/post.ejs | 41 |
3 files changed, 49 insertions, 2 deletions
diff --git a/languages/default.yml b/languages/default.yml index e280019..73af215 100644 --- a/languages/default.yml +++ b/languages/default.yml @@ -1,4 +1,7 @@ next: Next Page prev: Previous Page listen: Listen Now -read: Continue Read
\ No newline at end of file +read: Continue Read +timeline: Timeline +authors: Authors +references: References
\ No newline at end of file diff --git a/languages/zh-cn.yml b/languages/zh-cn.yml index c46f638..9d618fc 100644 --- a/languages/zh-cn.yml +++ b/languages/zh-cn.yml @@ -1,4 +1,7 @@ next: 下一页 prev: 上一页 listen: 现在收听 -read: 继续阅读
\ No newline at end of file +read: 继续阅读 +timeline: 时间轴 +authors: 本期作者 +references: 相关资料
\ No newline at end of file diff --git a/layout/post.ejs b/layout/post.ejs index 008b20a..6997574 100644 --- a/layout/post.ejs +++ b/layout/post.ejs @@ -38,7 +38,48 @@ </script> <% } %> <section class="content is-size-6"> + <%- page.content %> + + <!-- Add podcast authors --> + + <% if (page.podcast && page.podcast.authors) { %> + <h3><%= __('authors') %>: </h3> + <ul> + <% (page.podcast.authors).forEach(function(author) { %> + <li><%= author %></li> + <% }); %> + </ul> + <% } %> + + <!-- Add podcast chapters --> + <% if (page.podcast && page.podcast.chapters) { %> + <h3><%= __('timeline') %>: </h3> + <ul> + <% (page.podcast.chapters).forEach(function(item) { %> + <% + const title = item[0]; + const timestamp = item[1]; + const hour = Math.floor(timestamp / 3600); + const minute = Math.floor((timestamp / 60) % 60); + const second = Math.floor(timestamp % 60); + const viewstr = String(hour).padStart(2, '0') + ':' + String(minute).padStart(2, '0') + ':' + String(second).padStart(2, '0'); + %> + <li class="is-family-monospace"><a href="#t=<%= viewstr %>"><%= viewstr %></a> <%= title %></li> + <% }); %> + </ul> + <% } %> + + <!-- Add podcast references --> + <% if (page.podcast && page.podcast.references) { %> + <h3><%= __('references') %>: </h3> + <ul> + <% (page.podcast.references).forEach(function(item) { %> + <li><a href="<%= item[1] %>" rel="noopener"><%= item[0] %></a></li> + <% }); %> + </ul> + <% } %> + </section> <div class="level"> <div class="level-left"> |