astro-link-preview
TypeScript icon, indicating that this package has built-in type declarations

0.3.4 • Public • Published

astro-link-preview

version

This Astro integration generates preview images for external links.


demo

Features

  • Supports both Static Site Generation (SSG) and Server-Side Rendering (SSR) modes.
  • Automatically optimizes images to improve loading performance.
  • Provides customizable styles for preview images.

Installation

# Using NPM
npm install astro-link-preview
# Using Yarn
yarn add astro-link-preview
# Using PNPM
pnpm add astro-link-preview

Config

// astro.config.mjs
import {defineConfig} from "astro/config"
import linkPreview from "astro-link-preview"
export default defineConfig({
  integrations: [
    linkPreview()
  ],
})

Options

import type { LaunchOptions } from 'playwright'

export interface Options {
  /**
   * Whether to log stats
   * @default true
   */
  logStats?: boolean
  /**
   * proxy settings
   */
  proxy?: LaunchOptions['proxy']
  /**
   * preview image format
   * @default 'jpg'
   */
  previewImageFormat?: 'png' | 'jpg'
  /**
   * whether to allow image previews on mobile devices
   * @default false
   */
  enableOnMobile?: boolean
}

How to use

see example

License

MIT © nemurubaka

Package Sidebar

Install

npm i astro-link-preview

Weekly Downloads

5

Version

0.3.4

License

MIT

Unpacked Size

18.4 kB

Total Files

7

Last publish

Collaborators

  • nemurubaka