You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: apps/web/content/blog/build-time-components.mdx
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -285,7 +285,7 @@ function rehypeLinkImage() {
285
285
}
286
286
```
287
287
288
-
This plugin adds a `data-image` attribute to every _`<a>`_ tag in the HTML syntax tree.
288
+
This plugin adds a `data-image` attribute to every _`<a>`_ tag in the HTML syntax tree (don't worry if you can't follow the code, the fact that it's hard to follow is one of the points I want to make later).
289
289
290
290
We can then use this attribute in our component and pass it to the _`<LinkWithCard>`_ component:
291
291
@@ -318,7 +318,7 @@ The **build-time plugin** approach:
318
318
319
319
But the **client-side** approach has some advantages too:
320
320
321
-
- ✅ All the behavior is contained in one component, for example, if we want to add the open graph desciption to the hover card, we can do it in one place
321
+
- ✅ All the behavior is contained in one component, for example, if we want to add the open graph description to the hover card, we can do it in one place
322
322
- ✅ We can use the component from other places, not just markdown
323
323
- ✅ We don't need to learn how to write rehype plugins
324
324
@@ -458,11 +458,11 @@ Comparing this to the other two approaches, we have all the advantages:
458
458
459
459
- ✅ Fetches on build-time, saving the users from making redundant work
460
460
- ✅ Doesn't ship the scraper code to the client
461
-
- ✅ All the behavior is contained in one component, for example, if we want to add the open graph desciption to the hover card, we can do it in one place
461
+
- ✅ All the behavior is contained in one component, for example, if we want to add the open graph description to the hover card, we can do it in one place
462
462
- ✅ We can use the component from other places, not just markdown
463
463
- ✅ We don't need to learn how to write rehype plugins
464
464
465
-
wihout any of the downsides.
465
+
without any of the downsides.
466
466
467
467
**This approach has the best of both worlds. Best UX, best DX.**
0 commit comments