Skip to content

Commit

Permalink
Fix paths to video resource when published to subdirectory (#669)
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisvire authored Aug 13, 2024
1 parent ddc22d1 commit ac1e198
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/lib/video/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import config from '$lib/data/config';
import { base } from '$app/paths';
enum VideoType {
None = 'none',
YouTube = 'youtube',
Expand Down Expand Up @@ -68,7 +69,7 @@ export function createVideoBlock(document: Document, video: any, index: any): HT
}
videoContainerDiv.style.setProperty(
'background-image',
"url('images/" + video.thumbnail + "')"
`url('${base}/images/${video.thumbnail}')`
);
const videoLink = document.createElement('a');
videoLink.setAttribute('href', '#');
Expand All @@ -88,7 +89,7 @@ export function createVideoBlock(document: Document, video: any, index: any): HT
);
}
const videoImg = document.createElement('img');
videoImg.setAttribute('src', 'video_play_01.svg');
videoImg.setAttribute('src', `${base}/video_play_01.svg`);
videoLink.appendChild(videoImg);
videoContainerDiv.appendChild(videoLink);
videoBlockDiv.appendChild(videoContainerDiv);
Expand Down Expand Up @@ -123,7 +124,7 @@ export function addVideoLinks(document: Document, videos: any[]) {
const script = document.createElement('script');
script.id = 'js_video';
script.type = 'text/javascript';
script.src = 'js/app-builder-video.js';
script.src = `${base}/js/app-builder-video.js`;
if (!document.getElementById(script.id)) {
document.head.appendChild(script);
}
Expand Down

0 comments on commit ac1e198

Please sign in to comment.