Skip to content

Commit cdd86f0

Browse files
authored
Merge pull request #233 from Suzu-Gears/add-Bookmark-Caption
Add bookmark caption
2 parents 4f8019a + 7610f54 commit cdd86f0

File tree

3 files changed

+5
-1
lines changed

3 files changed

+5
-1
lines changed

src/components/notion-blocks/Bookmark.astro

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import metascraperTitle from 'metascraper-title'
66
import { isAmazonURL, isGitHubURL } from '../../lib/blog-helpers.ts'
77
import GithubLinkPreview from './GitHubLinkPreview.astro'
88
import * as interfaces from '../../lib/interfaces.ts'
9+
import Caption from './Caption.astro'
910
1011
export interface Props {
1112
block: interfaces.Block
@@ -73,6 +74,7 @@ try {
7374
)}
7475
</div>
7576
</a>
77+
<Caption richTexts={block.Bookmark?.Caption ?? []} />
7678
</div>
7779
)}
7880
</>
@@ -86,7 +88,7 @@ try {
8688
opacity: 0.7;
8789
}
8890
.bookmark {
89-
display: flex;
91+
display: block;
9092
overflow: hidden;
9193
width: 100%;
9294
max-width: 100%;

src/lib/interfaces.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@ export interface Embed {
169169
}
170170

171171
export interface Bookmark {
172+
Caption: RichText[]
172173
Url: string
173174
}
174175

src/lib/notion/client.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -722,6 +722,7 @@ function _buildBlock(blockObject: responses.BlockObject): Block {
722722
case 'bookmark':
723723
if (blockObject.bookmark) {
724724
const bookmark: Bookmark = {
725+
Caption: blockObject.bookmark.caption?.map(_buildRichText) || [],
725726
Url: blockObject.bookmark.url,
726727
}
727728
block.Bookmark = bookmark

0 commit comments

Comments
 (0)