{entry.data.title}
- {authorInfo.map((a: any) =>{entry.data.summary}
} -diff --git a/src/components/shortcodes/LinkCard.astro b/src/components/shortcodes/LinkCard.astro index 7cdb361..b8097d4 100644 --- a/src/components/shortcodes/LinkCard.astro +++ b/src/components/shortcodes/LinkCard.astro @@ -1,6 +1,4 @@ --- -import { getMetadata, getWaybackMetadata } from '../../plugins/get-metadata'; - interface Props { url: string; showArchive?: boolean; @@ -31,12 +29,71 @@ function formatDateToNumber(date: Date | string | undefined): string { return `${year}${month}${day}`; } -// Determine which date to use (prefer updatedDate if available, or fallback to the build time) -const timestamp = (updatedDate ? formatDateToNumber(updatedDate) : formatDateToNumber(pubDate)) || formatDateToNumber(new Date()); +// Get metadata from the URL +async function fetchMetadata(url: string) { + try { + const response = await fetch(url, { + headers: { + 'User-Agent': 'Mozilla/5.0 (compatible; LinkCard/1.0)' + } + }); + + if (!response.ok) { + throw new Error(`HTTP ${response.status}`); + } + + const html = await response.text(); + + // 提取元数据 + const titleMatch = html.match(/
{entry.data.summary}
} -{entry.data.summary}
} +