Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

astro-embeds-twitter

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

astro-embeds-twitter

Component to easily embed Tweets 🐦 on your Astro 🚀 site

  • 1.0.0-beta.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

astro-embeds-twitter

This package contains a component for embedding tweets in Astro projects.

Install

pnpm i astro-embeds-twitter

Usage

<Tweet id={tweetUrl} />

The Tweet component generates a static Twitter card for a single Tweet using Twitter’s oEmbed API.

---
import { Tweet } from 'astro-embeds-twitter'
---

<Tweet id="https://twitter.com/astrodotbuild/status/1511750228428435457" />

Loading Twitter’s JavaScript

By design, this is a minimal component and loads zero JavaScript, only rendering some static HTML content. However, this HTML is compatible with Twitter’s widget system. Loading Twitter's large bundle of widget JavaScript will convert each <Tweet /> into an interactive embed.

You can do this by including a <script> tag in your Astro layout file:

<script async src="https://platform.twitter.com/widgets.js"></script>

Styling

By default the card has minimal styling, which should adapt to your site’s font settings etc.

You can customize it by targeting the .twitter-tweet class, for example:

.twitter-tweet {
  background: floralwhite;
  font-family: sans-serif;
  border: 0;
}

.twitter-tweet a {
  color: purple;
  font-weight: bold;
}

Keywords

FAQs

Package last updated on 26 Jan 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc