Skip to content

Commit

Permalink
add embedded youtube
Browse files Browse the repository at this point in the history
  • Loading branch information
shawn111 committed Nov 24, 2024
1 parent 1bddadf commit f8b6548
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ export const SITE: Site = {
title: "KaLUG.tw",
ogImage: "kalug-people.jpg",
lightAndDarkMode: true,
postPerIndex: 4,
postPerPage: 3,
postPerIndex: 5,
postPerPage: 10,
//scheduledPostMargin: 15 * 60 * 1000, // 15 minutes
scheduledPostMargin: 30 * 24 * 60 * 60 * 1000, // 15 minutes
showArchives: true,
Expand Down
11 changes: 11 additions & 0 deletions src/layouts/PostDetails.astro
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ const {
pubDatetime,
modDatetime,
tags,
youtube,
editPost,
} = post.data;
Expand All @@ -37,6 +38,8 @@ const ogUrl = new URL(
Astro.url.origin
).href;
const ylink = "https://www.youtube.com/embed/"+youtube;
const layoutProps = {
title: `${title} | ${SITE.title}`,
author,
Expand Down Expand Up @@ -88,6 +91,14 @@ const nextPost =
postId={post.id}
/>
<article id="article" class="prose mx-auto mt-8 max-w-3xl">
{
youtube && (
<div>
<iframe width="560" height="315" src={ylink} title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>
</div>
)
}

<Content />
</article>

Expand Down

0 comments on commit f8b6548

Please sign in to comment.