Skip to content

Commit c8f8f9c

Browse files
committed
Add LinkedIn feed to news page
1 parent ac5166e commit c8f8f9c

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed

components/LinkedInStream.tsx

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import { useEffect } from "react";
2+
3+
export default function LinkedInStream() {
4+
useEffect(() => {
5+
const script = document.createElement("script");
6+
script.src = "https://platform.linkedin.com/badges/js/profile.js";
7+
script.async = true;
8+
script.defer = true;
9+
document.body.appendChild(script);
10+
11+
return () => {
12+
document.body.removeChild(script);
13+
};
14+
}, []);
15+
16+
return (
17+
<div className="fixed top-24 right-4 w-80">
18+
<div
19+
className="LI-profile-badge"
20+
data-version="v1"
21+
data-size="medium"
22+
data-locale="nl_NL"
23+
data-type="company"
24+
data-theme="light"
25+
data-vanity="nuts-foundation"
26+
>
27+
<a
28+
className="LI-simple-link"
29+
href="https://nl.linkedin.com/company/nuts-foundation"
30+
>
31+
Nuts Foundation
32+
</a>
33+
</div>
34+
</div>
35+
);
36+
}

pages/[name].tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { NextSeo } from "next-seo"
22
import { GetStaticPaths, GetStaticPathsContext, GetStaticPropsContext, InferGetStaticPropsType } from "next"
33

44
import Layout from "../components/Layout"
5+
import LinkedInStream from "../components/LinkedInStream"
56
import { getPost, getPosts } from "../lib/api"
67

78
interface PostProps extends InferGetStaticPropsType<typeof getStaticProps> {
@@ -11,6 +12,7 @@ export default function Post({ post }: PostProps) {
1112
return (
1213
<Layout>
1314
<NextSeo openGraph={{ title: `Nuts - ${post.meta["title"]}` }} />
15+
{post.name === "nieuws" && <LinkedInStream />}
1416

1517
<div className="px-4">
1618
<article

0 commit comments

Comments
 (0)