Skip to content

Commit

Permalink
🎉 Feat: add douyin shortcode support
Browse files Browse the repository at this point in the history
  • Loading branch information
Lruihao committed May 20, 2024
1 parent aa68514 commit d7c0636
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
16 changes: 16 additions & 0 deletions assets/css/_shortcodes/_douyin.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
.douyin {
position: relative;
width: 100%;
height: 0;
padding-bottom: 60.725%;
margin: 3% auto;
text-align: center;

iframe {
position: absolute;
width: 100%;
height: 100%;
left: 0;
top: 0;
}
}
1 change: 1 addition & 0 deletions assets/css/_shortcodes/_index.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
@import '_admonition';
@import '_bilibili';
@import '_douyin';
@import '_cardlink';
@import '_center-quote';
@import '_echarts';
Expand Down
7 changes: 7 additions & 0 deletions layouts/shortcodes/douyin.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{{- /* reference https://developer.open-douyin.com/docs/resource/zh-CN/dop/develop/openapi/video-management/douyin/iframe-player/get-iframe-by-video */ -}}
{{- $id := cond .IsNamedParams (.Get "id") (.Get 0) -}}

<div class="douyin">
<iframe src="//open.douyin.com/player/video?vid={{ $id }}&autoplay=0" border="0" framespacing="0" allowfullscreen="true"></iframe>
</div>
{{- /* EOF */ -}}

0 comments on commit d7c0636

Please sign in to comment.