Post

유튜브 임베드 시작 시간 포함

유튜브 임베드 시작 시간 포함


유튜브 영상 임베드에 시작 시간을 포함시키고 싶다.




_includes\embed\youtube.html 수정

start 옵션을 받을 수 있도록 src에 조건문 추가

1
2
3
4
5
6
7
8
9
10
11
<iframe
  class="embed-video"
  loading="lazy"
  src="https://www.youtube.com/embed/{{ include.id }}{% if include.start %}?start={{ include.start }}{% endif %}"
  title="YouTube video player"
  frameborder="0"
  allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
  allowfullscreen>
</iframe>


1
2
3
4
5
6
7
8
9
10
11
12
<!-- 기존 코드 -->

<iframe
  class="embed-video"
  loading="lazy"
  src="https://www.youtube.com/embed/{{ include.id }}"
  title="YouTube video player"
  frameborder="0"
  allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
  allowfullscreen
></iframe>




사용법

1
2
3
{% include embed/youtube.html id="oBFvMykNG7g" start="239" %}

This post is licensed under CC BY 4.0 by the author.