npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

astro-link-card

v1.0.22

Published

Astro integration to automatically convert bare links into link cards.

Downloads

945

Readme

astro-link-card

Astro integration to automatically convert bare links into link cards. This is a wrapper for rehype-og-card with some configuration optimizations for Astro.

Features

This integration will automatically convert bare links into link cards. This is useful for creating a more visually appealing website with link previews. Here are some key features:

  • Automatically convert bare links into link cards
  • Server-side image caching
  • Build cache for images and Open Graph metadata for faster builds
  • Lazy loading and async decoding for images
  • Zero runtime JavaScript (all processing is done at build time)

The following links will be converted to link cards:

  • Bare links
  • Links that have the same URL and text (if you enable the enableSameTextURLConversion option)

The following links will NOT be converted to link cards:

  • Links in lists
  • Links in code blocks
  • Links in sentences
  • Non-bare links
  • Links that have the same URL and text (if you disable the enableSameTextURLConversion option)

Input:

this is a link: https://blog.google/products/android/world-emoji-day-2024/

`https://blog.google/products/android/world-emoji-day-2024/`

https://blog.google/products/android/world-emoji-day-2024/

Output (formatted for readability):

<p>this is a link: https://blog.google/products/android/world-emoji-day-2024/</p>
<p><code>https://blog.google/products/android/world-emoji-day-2024/</code></p>
<p><div class="og-card-container">
    <a href="https://blog.google/products/android/world-emoji-day-2024/">
        <div class="og-card-info">
            <div class="og-card-title">10 fun facts about emoji for World Emoji Day</div>
            <div class="og-card-description">Celebrate World Emoji Day with Google, and check out what’s new for Emoji Kitchen.</div>
            <div class="og-card-url-container">
                <img class="og-card-favicon" alt="favicon" decoding="async" height="16" loading="lazy" src="https://www.google.com/s2/favicons?domain=blog.google" width="16">
                <span class="og-card-url">blog.google</span>
            </div>
        </div>
        <div class="og-card-image-container">
            <img class="og-card-image" alt="https://storage.googleapis.com/gweb-uniblog-publish-prod/images/world_emoji_day_v2_1.width-1300.png" decoding="async" loading="lazy" src="https://storage.googleapis.com/gweb-uniblog-publish-prod/images/world_emoji_day_v2_1.width-1300.png">
        </div>
    </a>
</div></p>

Installation

astro add command (Recommended)

npx astro add astro-link-card

Manual Installation (Alternative)

npm install astro-link-card
import { defineConfig } from "astro";
import linkCard from "astro-link-card";

// https://astro.build/config
export default defineConfig({
    // ... other config
    integrations: [
        linkCard({
            // options
        })
    ]
});

Options

All rehype-og-card options are supported. You can find the full list of options here. Some options below are optimized for Astro:

  • enableSameTextURLConversion (default: true): Enable conversion of links that have the same URL and text. This is useful for projects that have markdown.gfm enabled.
  • serverCache (default: true): Enable server-side image caching.
  • serverCachePath (default: "./public"): Path to store server-side image cache.
  • buildCache (default: true): Enable build cache for images and Open Graph metadata.
  • buildCachePath (default: "./node_modules/.astro"): Path to store build cache.