Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cijiugechu/astro-link-preview
This Astro integration generates preview images for external links.
https://github.com/cijiugechu/astro-link-preview
astro astro-integration external-links image links preview
Last synced: 26 days ago
JSON representation
This Astro integration generates preview images for external links.
- Host: GitHub
- URL: https://github.com/cijiugechu/astro-link-preview
- Owner: cijiugechu
- License: mit
- Created: 2023-05-28T15:29:07.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-12-18T17:34:16.000Z (about 1 month ago)
- Last Synced: 2024-12-24T06:49:30.440Z (about 1 month ago)
- Topics: astro, astro-integration, external-links, image, links, preview
- Language: TypeScript
- Homepage:
- Size: 854 KB
- Stars: 37
- Watchers: 1
- Forks: 3
- Open Issues: 12
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
astro-link-preview
ThisAstro
integration generates preview images for external links.
![demo](/assets/demo.gif)
## 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
```shell
# Using NPM
npm install astro-link-preview
# Using Yarn
yarn add astro-link-preview
# Using PNPM
pnpm add astro-link-preview
```## Config
```js
// astro.config.mjs
import {defineConfig} from "astro/config"
import linkPreview from "astro-link-preview"
export default defineConfig({
integrations: [
linkPreview()
],
})
```## Options
```ts
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](./packages/playground/)
## License
MIT © [nemurubaka](https://github.com/cijiugechu)