Skip to content

Commit 805bc5d

Browse files
committed
feat: support external embed in bskypost
1 parent 2cf9c07 commit 805bc5d

File tree

2 files changed

+34
-5
lines changed

2 files changed

+34
-5
lines changed

app/components/global/BlueskyPostEmbed.client.vue

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,18 @@ interface EmbedImage {
2626
aspectRatio?: { width: number; height: number }
2727
}
2828
29+
interface EmbedExternal {
30+
description?: string
31+
thumb?: string
32+
title?: string
33+
uri: string
34+
}
35+
2936
interface BlueskyPost {
3037
uri: string
3138
author: PostAuthor
3239
record: { text: string; createdAt: string }
33-
embed?: { $type: string; images?: EmbedImage[] }
40+
embed?: { $type: string; images?: EmbedImage[]; external?: EmbedExternal }
3441
likeCount?: number
3542
replyCount?: number
3643
repostCount?: number
@@ -81,6 +88,7 @@ const { data: post, status } = useAsyncData(
8188
)
8289
8390
const postUrl = computed(() => {
91+
console.log(post.value?.embed)
8492
// Prefer the explicit URL prop if provided
8593
if (props.url) return props.url
8694
@@ -107,7 +115,7 @@ const postUrl = computed(() => {
107115
:href="postUrl ?? '#'"
108116
target="_blank"
109117
rel="noopener noreferrer"
110-
class="not-prose block rounded-lg border border-border bg-bg-subtle p-4 sm:p-5 no-underline hover:border-border-hover transition-colors duration-200 relative group"
118+
class="not-prose block my-4 rounded-lg border border-border bg-bg-subtle p-4 sm:p-5 no-underline hover:border-border-hover transition-colors duration-200 relative group"
111119
>
112120
<!-- Bluesky icon -->
113121
<span
@@ -154,6 +162,27 @@ const postUrl = computed(() => {
154162
/>
155163
</template>
156164

165+
<!-- Embedded external embed -->
166+
<template v-if="post.embed?.external && post.embed.external.uri">
167+
<div class="block mb-3 p-0.5 bg-bg-muted rounded-lg">
168+
<img
169+
v-if="post.embed.external.thumb"
170+
:src="post.embed.external.thumb"
171+
:alt="post.embed.external.title"
172+
class="w-full rounded-lg object-cover"
173+
loading="lazy"
174+
/>
175+
<div class="text-fg-muted text-sm p-2">
176+
<p class="font-medium truncate">
177+
{{ post.embed.external.title || post.embed.external.uri }}
178+
</p>
179+
<p v-if="post.embed.external.description" class="text-sm line-clamp-2 mt-1">
180+
{{ post.embed.external.description }}
181+
</p>
182+
</div>
183+
</div>
184+
</template>
185+
157186
<!-- Timestamp + engagement -->
158187
<div class="flex items-center gap-4 text-sm text-fg-subtle">
159188
<DateTime :datetime="post.record.createdAt" date-style="medium" />

app/pages/blog/release/0.8.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,15 +54,15 @@ There is a lot to unpack, a lot of potential for collaborating with other atprot
5454

5555
[ keynote video: youtube or streamplace ].
5656

57-
# Noodles!
57+
## Noodles!
5858

5959
Thinking about who we are and what we stand for, we decided to launch noodles. The little change on the main page focused on what we care about.
6060

6161
https://npmx.dev/?kawaii
6262

6363
<BlueskyPostEmbed url="https://bsky.app/profile/npmx.dev/post/3miet6zoc5s2i" />
6464

65-
# News
65+
## News
6666

6767
A lot has happened since our [alpha launch](link). You can read Alex’s post for an overview of this past month, and to learn about some of the ideas the community is working on.
6868

@@ -72,6 +72,6 @@ We were also featured the latest Igalia Chats episode discussing about the histo
7272

7373
<BlueskyPostEmbed url="https://bsky.app/profile/igalia.com/post/3miwbkgbgyk2m" />
7474

75-
# What’s next
75+
## What’s next
7676

7777
We have several features in the making, npmx 0.9 is already looking like a very interesting milestone for us. If you’re interested in getting involved, join us at [build.npmx.dev](https://build.npmx.dev). We’re just getting started!

0 commit comments

Comments
 (0)