Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion _includes/embed/audio.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
{% endunless %}

<p>
<audio class="embed-audio" controls>
<audio class="embed-audio file" controls>
{% assign extension = src | split: '.' | last %}
{% assign types = extension | concat: types %}

Expand Down
22 changes: 22 additions & 0 deletions _includes/embed/spotify.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{% assign size = 352 %}
{% assign theme = '' %}

{% if include.compact %}
{% assign size = 152 %}
{% endif %}

{% if include.dark %}
{% assign theme = '?theme=0' %}
{% endif %}

<iframe
class="embed-audio spotify"
src="https://open.spotify.com/embed/track/{{ include.id | append: theme }}"
height="{{ size }}"
frameBorder="0"
allowfullscreen=""
allowtransparency="true"
allow="autoplay; clipboard-write; encrypted-media; fullscreen; picture-in-picture"
loading="lazy"
>
</iframe>
28 changes: 16 additions & 12 deletions _posts/2019-08-08-write-a-new-post.md
Original file line number Diff line number Diff line change
Expand Up @@ -256,27 +256,31 @@ For normal images:
```
{: .nolineno }

### Video
### Social Media Platforms

#### Social Media Platform

You can embed videos from social media platforms with the following syntax:
You can embed video/audio from social media platforms with the following syntax:

```liquid
{% include embed/{Platform}.html id='{ID}' %}
```

Where `Platform` is the lowercase of the platform name, and `ID` is the video ID.

The following table shows how to get the two parameters we need in a given video URL, and you can also know the currently supported video platforms.
The following table shows how to get the two parameters we need in a given video/audio URL, and you can also know the currently supported video platforms.

| Video URL | Platform | ID |
| -------------------------------------------------------------------------------------------------------------------------- | ---------- | :----------------------- |
| [https://www.**youtube**.com/watch?v=**H-B46URT4mg**](https://www.youtube.com/watch?v=H-B46URT4mg) | `youtube` | `H-B46URT4mg` |
| [https://www.**twitch**.tv/videos/**1634779211**](https://www.twitch.tv/videos/1634779211) | `twitch` | `1634779211` |
| [https://www.**bilibili**.com/video/**BV1Q44y1B7Wf**](https://www.bilibili.com/video/BV1Q44y1B7Wf) | `bilibili` | `BV1Q44y1B7Wf` |
| [https://www.open.**spotify**.com/track/**3OuMIIFP5TxM8tLXMWYPGV**](https://open.spotify.com/track/3OuMIIFP5TxM8tLXMWYPGV) | `spotify` | `3OuMIIFP5TxM8tLXMWYPGV` |

Spotify supports some additional parameters:

| Video URL | Platform | ID |
| -------------------------------------------------------------------------------------------------- | ---------- | :------------- |
| [https://www.**youtube**.com/watch?v=**H-B46URT4mg**](https://www.youtube.com/watch?v=H-B46URT4mg) | `youtube` | `H-B46URT4mg` |
| [https://www.**twitch**.tv/videos/**1634779211**](https://www.twitch.tv/videos/1634779211) | `twitch` | `1634779211` |
| [https://www.**bilibili**.com/video/**BV1Q44y1B7Wf**](https://www.bilibili.com/video/BV1Q44y1B7Wf) | `bilibili` | `BV1Q44y1B7Wf` |
- `compact` - to display compact player instead (ex. `{% include embed/spotify.html id='3OuMIIFP5TxM8tLXMWYPGV' compact=1 %}`);
- `dark` - to force dark theme (ex. `{% include embed/spotify.html id='3OuMIIFP5TxM8tLXMWYPGV' dark=1 %}`).

#### Video Files
### Video Files

If you want to embed a video file directly, use the following syntax:

Expand Down Expand Up @@ -310,7 +314,7 @@ Consider an example using all of the above:
%}
```

### Audios
### Audio Files

If you want to embed an audio file directly, use the following syntax:

Expand Down
9 changes: 8 additions & 1 deletion _sass/base/_base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,14 @@ main {

.embed-audio {
width: 100%;
display: block;

&.file {
display: block;
}

&.spotify {
border-radius: 14px;
}

@extend %img-caption;
}
Expand Down