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

@astro-community/astro-embed-twitter

Package Overview
Dependencies
Maintainers
6
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@astro-community/astro-embed-twitter

Component to easily embed Tweets on your Astro site

  • 0.5.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
6.6K
decreased by-12.21%
Maintainers
6
Weekly downloads
 
Created
Source

@astro-community/astro-embed-twitter

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

Install

npm i @astro-community/astro-embed-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-community/astro-embed-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 customise 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 22 Aug 2023

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