about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--bskyembed/src/components/link.tsx7
-rw-r--r--bskyembed/src/screens/landing.tsx2
-rw-r--r--src/components/dialogs/Embed.tsx8
3 files changed, 13 insertions, 4 deletions
diff --git a/bskyembed/src/components/link.tsx b/bskyembed/src/components/link.tsx
index 7226ecf3d..db752542b 100644
--- a/bskyembed/src/components/link.tsx
+++ b/bskyembed/src/components/link.tsx
@@ -8,9 +8,14 @@ export function Link({
   href: string
   className?: string
 } & h.JSX.HTMLAttributes<HTMLAnchorElement>) {
+  const newSearchParam = new URLSearchParams()
+  newSearchParam.set('ref_src', 'embed')
+
   return (
     <a
-      href={href.startsWith('http') ? href : `https://bsky.app${href}`}
+      href={`${
+        href.startsWith('http') ? href : `https://bsky.app${href}`
+      }?${newSearchParam.toString()}`}
       target="_blank"
       rel="noopener noreferrer nofollow"
       onClick={evt => evt.stopPropagation()}
diff --git a/bskyembed/src/screens/landing.tsx b/bskyembed/src/screens/landing.tsx
index 0c5508935..72612db0e 100644
--- a/bskyembed/src/screens/landing.tsx
+++ b/bskyembed/src/screens/landing.tsx
@@ -242,7 +242,7 @@ function Snippet({thread}: {thread: AppBskyFeedDefs.ThreadViewPost}) {
 }
 
 function toShareUrl(path: string) {
-  return `https://bsky.app${path}`
+  return `https://bsky.app${path}?ref_src=embed`
 }
 
 /**
diff --git a/src/components/dialogs/Embed.tsx b/src/components/dialogs/Embed.tsx
index 0478dbae8..7d858cae4 100644
--- a/src/components/dialogs/Embed.tsx
+++ b/src/components/dialogs/Embed.tsx
@@ -58,10 +58,14 @@ function EmbedDialogInner({
   }, [copied])
 
   const snippet = React.useMemo(() => {
+    function toEmbedUrl(href: string) {
+      return toShareUrl(href) + '?ref_src=embed'
+    }
+
     const lang = record.langs && record.langs.length > 0 ? record.langs[0] : ''
-    const profileHref = toShareUrl(['/profile', postAuthor.did].join('/'))
+    const profileHref = toEmbedUrl(['/profile', postAuthor.did].join('/'))
     const urip = new AtUri(postUri)
-    const href = toShareUrl(
+    const href = toEmbedUrl(
       ['/profile', postAuthor.did, 'post', urip.rkey].join('/'),
     )