ilapaj Library
Articles 日本語
4 min read (707 words)

[Astro] remark-link-card-plus Is God-Tier

This is an English translation of the original Japanese article, translated with the help of AI.
Table of Contents

I had been using remark-link-card to implement link cards on this blog.

However, this plugin had several issues.

To avoid this, I had no choice but to give up on writing URLs inside bullet lists.

Cannot Fetch Images if the Image Size Is Too Large#

You get an error like this. It happened frequently, especially when trying to make link cards for YouTube videos.

[remark-link-card] Error: Failed to get the Open Graph data of https://www.youtube.com/watch?v=PAe7tPJqXnQ due to Exceeded the download limit of 1000000 bytes.

Searching for the error message turned up no other similar reports.

Solution#

While trying to solve it myself, I stumbled across the following article.

When I installed it, lo and behold, both of these issues were solved!!!

For the CSS, I referenced the following article and adapted it directly for remark-link-card-plus.

/* Breakpoint: 60ch (based on max-width of Tailwindcss/Typography prose) */
.remark-link-card-plus__container {
width: 100%;
margin-bottom: 1.25em;
}
.remark-link-card-plus__card {
--padding-x: 1rem;
--padding-y: 0.7rem;
--border-radius: calc(0.5rem - 1px);
border: 1px solid var(--tw-prose-hr);
border-radius: calc(var(--border-radius) + 1px);
text-decoration: none;
display: grid;
grid-template-columns: 1fr 116px;
gap: 1rem;
@media (min-width: 60ch) {
grid-template-columns: 1fr 220px;
}
transition: background-color 150ms;
&:hover {
background-color: var(--primary-color);
@media (prefers-color-scheme: dark) {
background-color: var(--primary-color-lighten);
}
}
}
.remark-link-card-plus__main {
display: flex;
flex-direction: column;
justify-content: center;
font-weight: normal;
grid-column: 1;
padding: var(--padding-y) 0 var(--padding-y) var(--padding-x);
max-width: 100%;
min-width: 100%;
border-radius: var(--border-radius) 0 0 var(--border-radius);
}
/*
.remark-link-card-plus__content {
}
*/
.remark-link-card-plus__title {
font-size: 1rem;
font-weight: bold;
line-height: 1.3;
color: var(--tw-prose-headings);
overflow: hidden;
display: -webkit-box;
text-overflow: ellipsis;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
line-clamp: 2;
}
.remark-link-card-plus__description {
font-size: 0.8rem;
color: #737373;
@media (prefers-color-scheme: dark) {
color: #a3a3a3;
}
margin-bottom: 0.5em;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
-webkit-line-clamp: 1;
line-clamp: 1;
}
.remark-link-card-plus__meta {
display: flex;
align-items: center;
gap: 0.5rem;
}
.remark-link-card-plus__favicon {
margin-top: 0.15rem;
margin-bottom: 0;
}
.remark-link-card-plus__url {
font-size: 0.8rem;
color: #525252;
@media (prefers-color-scheme: dark) {
color: #d4d4d4;
}
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
-webkit-line-clamp: 1;
line-clamp: 1;
}
.remark-link-card-plus__thumbnail {
grid-column: 2;
aspect-ratio: 1 / 1;
@media (min-width: 60ch) {
aspect-ratio: 1.91 / 1;
}
}
.remark-link-card-plus__image {
object-fit: cover;
height: 100%;
width: 100%;
margin: 0;
border-radius: 0 var(--border-radius) var(--border-radius) 0;
}

More articles

All articles →
ilapaj
ilapaj

Notes on games, radio and technology, translated from the Japanese blog.

封面
Sample Song
Sample Artist
封面
Sample Song
Sample Artist
0:00 / 0:00