Skip to content

Commit

Permalink
Add og:video:secure_url and og:video:type (#562)
Browse files Browse the repository at this point in the history
  • Loading branch information
TomPradat committed Apr 15, 2021
1 parent b2a6846 commit e9b3a10
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
4 changes: 4 additions & 0 deletions e2e/pages/overridden.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,16 @@ const Overridden = () => (
videos: [
{
url: 'https://www.test.ie/og-video-b-01.jpg',
secureUrl: 'https://www.test.ie/og-video-b-01.jpg',
type: 'application/x-shockwave-flash',
width: 850,
height: 650,
alt: 'Og Video Alt B',
},
{
url: 'https://www.test.ie/og-video-b-02.jpg',
secureUrl: 'https://www.test.ie/og-video-b-02.jpg',
type: 'application/x-shockwave-flash',
width: 950,
height: 850,
alt: 'Og Video Alt B Second',
Expand Down
20 changes: 20 additions & 0 deletions src/meta/buildTags.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -619,6 +619,26 @@ const buildTags = (config: BuildTagsParams) => {
/>,
);
}

if (video.secureUrl) {
tagsToRender.push(
<meta
key={`og:video:secure_url${index}`}
property="og:video:secure_url"
content={video.secureUrl.toString()}
/>,
);
}

if (video.type) {
tagsToRender.push(
<meta
key={`og:video:type${index}`}
property="og:video:type"
content={video.type.toString()}
/>,
);
}
});
}

Expand Down
2 changes: 2 additions & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ export interface OpenGraphVideos {
width?: number;
height?: number;
alt?: string;
type?: string;
secureUrl?: string;
}

export interface Address {
Expand Down

0 comments on commit e9b3a10

Please sign in to comment.