From 93d0cc92e76a88e0f9992e25718db0f1b6e0b44e Mon Sep 17 00:00:00 2001 From: Sandra Ashipala Date: Fri, 16 Jun 2023 03:58:04 +0200 Subject: [PATCH 1/2] fix: profile share preview (#7609) * Update [username].js Updated profile link to preview correctly on share * fix for cleanBio - [username].js fix for cleanBio --- pages/[username].js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/pages/[username].js b/pages/[username].js index a7cbe7a6564..a8c2c795132 100644 --- a/pages/[username].js +++ b/pages/[username].js @@ -37,12 +37,14 @@ export async function getServerSideProps(context) { } log.info(`data loaded for username: ${username}`); - + try { - profile.cleanBio = String(await remark().use(strip).process(profile.bio)); - } catch (e) { - log.error(e, `cannot strip markdown for: ${username}`); - } + const processedBio = await remark().use(strip).process(profile.bio); + profile.cleanBio = processedBio.toString(); +} catch (e) { + log.error(e, `cannot strip markdown for: ${username}`); + profile.cleanBio = profile.bio; +} return { props: { data: profile, BASE_URL: clientEnv.NEXT_PUBLIC_BASE_URL }, @@ -57,7 +59,7 @@ export default function User({ data, BASE_URL }) { description={data.cleanBio} ogTitle={data.name} ogUrl={`https://linkfree.eddiehub.io/${data.username}`} - ogImage={data.avatar} + ogImage={`https://github.com/${data.username}.png`} ogType="image/png" /> From c7b942d901732001c4eef0d3e13ac4529d472f6f Mon Sep 17 00:00:00 2001 From: Eddie Jaoude Date: Fri, 16 Jun 2023 08:59:23 +0700 Subject: [PATCH 2/2] fix: formatting --- pages/[username].js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pages/[username].js b/pages/[username].js index a8c2c795132..5cbc92e34d1 100644 --- a/pages/[username].js +++ b/pages/[username].js @@ -37,14 +37,14 @@ export async function getServerSideProps(context) { } log.info(`data loaded for username: ${username}`); - + try { const processedBio = await remark().use(strip).process(profile.bio); profile.cleanBio = processedBio.toString(); -} catch (e) { - log.error(e, `cannot strip markdown for: ${username}`); - profile.cleanBio = profile.bio; -} + } catch (e) { + log.error(e, `cannot strip markdown for: ${username}`); + profile.cleanBio = profile.bio; + } return { props: { data: profile, BASE_URL: clientEnv.NEXT_PUBLIC_BASE_URL },