Socket
Book a DemoInstallSign in
Socket

astro-seo-plugin

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

astro-seo-plugin

A strong and reliable Astro SEO optimization plugin made just for Astro-based websites that boosts performance, makes sites more visible to search engines, and helps developers get their sites to rank higher. It does this through smart analytics and by ma

1.3.5
latest
Source
npmnpm
Version published
Maintainers
1
Created
Source

Alt Text

⚡Astro SEO Plugin

npm version npm downloads TypeScript Built with Astro

A powerful and well-tested Astro SEO optimization plugin designed for Astro-based websites improves productivity, helps search engines find sites more , and assists developers in getting their sites to rank better. It achieves this through clever analytics and by handling metadata. This plugin provides developers with the necessary tools, and it supports both Astro 4 and Astro 5 making sure it works with the newest versions and stays compatible with up-to-date Astro features.

  • ✨ Meta tags management
  • 🔍 JSON-LD structured data
  • 🤖 robots.txt generation
  • 🗺️ Sitemap support
  • 🎯 OpenGraph and Twitter card optimization

📥 Installation

npm install astro-seo-plugin

💻 Usage

To add valuable SEO tags to your Astro pages, import the <AstroSEO> component from astro-seo-plugin, and use it in the area of your layout or page. Set options for metadata, structured data, and robot settings to increase the visibility of your site in search engine results.

---
import { AstroSEO } from 'astro-seo-plugin';
---

<AstroSEO
  title="Your Page Title"
  description="Your page description"
  openGraph={{
    title: "OG Title",
    description: "OG Description",
    image: "https://example.com/og-image.jpg",
    type: "website"
  }}
  twitter={{
    card: "summary_large_image",
    site: "@yourusername",
    creator: "@yourusername"
  }}
  jsonLd={{
    "@type": "WebPage",
    name: "Your Page Name",
    description: "Your page description"
  }}
  robots={{
    index: false,
    follow: true,
    noarchive: true,
    nosnippet: true,
    maxSnippet: 150,
  }}
  additionalLinkTags={[
    { rel: "canonical", href: "#" },
    { rel: "prev", href: Astro.url },
    { rel: "next", href: Astro.url },
    { rel: "alternate", href: Astro.url }
  ]}
  additionalMetaTags={[
    {
    name: "keywords",
    content: "your, keywords, here, separated, by, commas"
    }
  ]}
/>

📝 Supported Props

Prop PathTypeDescriptionPossible Values/Structure
Basic SEO Properties
titlestringMain page titleAny text
titleTemplatestringTemplate for titleFormat with %s (e.g., "%s | My Site")
descriptionstringMeta descriptionAny text
canonicalstringCanonical URLFull URL
noindexbooleanPrevents search engine indexingtrue/false
nofollowbooleanPrevents search engine link followingtrue/false
Open Graph Properties
openGraph.titlestringOG titleAny text
openGraph.descriptionstringOG descriptionAny text
openGraph.typestringOG content typewebsite, article, product, etc.
openGraph.imagestringOG image URLFull URL
openGraph.urlstringOG URLFull URL
openGraph.siteNamestringOG site nameAny text
openGraph.localestringOG localee.g., en_US, es_ES
Twitter Card Properties
twitter.cardstringTwitter card typesummary, summary_large_image, app, player
twitter.sitestringWebsite's Twitter handle@username
twitter.creatorstringContent creator's Twitter@username
twitter.titlestringTwitter card titleAny text
twitter.descriptionstringTwitter card descriptionAny text
twitter.imagestringTwitter card image URLFull URL
Robots Properties
robots.indexbooleanWhether to index the pagetrue/false
robots.followbooleanWhether to follow linkstrue/false
robots.noarchivebooleanPrevents page cachingtrue/false
robots.nosnippetbooleanPrevents snippet generationtrue/false
robots.maxSnippetnumberMaximum snippet lengthNumber of characters
robots.maxImagePreviewstringMaximum image preview sizenone, standard, large
robots.maxVideoPreviewnumberMaximum video preview lengthNumber of seconds
Additional Meta Tags Structure
additionalMetaTagsarrayArray of meta tag objectsArray of objects with following properties:
additionalMetaTags[].namestringMeta tag nameCommon examples:
- viewport
- theme-color
- format-detection
- apple-mobile-web-app-capable
- application-name
- author
- keywords
additionalMetaTags[].contentstringMeta tag contentCorresponding values
additionalMetaTags[].propertystringMeta tag property (alternative to name)Custom properties
additionalMetaTags[].httpEquivstringHTTP-equiv attributecontent-type, default-style, refresh
Additional Link Tags Structure
additionalLinkTagsarrayArray of link tag objectsArray of objects with following properties:
additionalLinkTags[].relstringLink relationshipCommon values:
- icon
- apple-touch-icon
- manifest
- preload
- preconnect
- dns-prefetch
- alternate
additionalLinkTags[].hrefstringLink URLFull URL or path
additionalLinkTags[].sizesstringIcon sizese.g., 16x16, 32x32, 180x180
additionalLinkTags[].typestringMIME typee.g., image/png, image/x-icon
additionalLinkTags[].mediastringMedia querye.g., (prefers-color-scheme: dark)
additionalLinkTags[].hreflangstringLanguage of linked resourcee.g., en-US, es
additionalLinkTags[].crossOriginstringCORS settinganonymous, use-credentials
JSON-LD
jsonLdobjectStructured data objectValid JSON-LD object

📦 Quick Start & Development

npm create astro@latest -- --template minimal

Open in StackBlitz Open with CodeSandbox Open in GitHub Codespaces

🚀 Project Structure

Inside of your Astro project, you'll see the following folders and files:

/
├── public/
├── src/
│   └── pages/
│       └── index.astro
└── package.json

Astro looks for .astro or .md files in the src/pages/ directory. Each page is exposed as a route based on its file name.

Any static assets, like images, can be placed in the public/ directory.

🧞 Commands

All commands are run from the root of the project, from a terminal:

CommandAction
npm installInstalls dependencies
npm run devStarts local dev server at localhost:4321
npm run buildBuild your production site to ./dist/
npm run previewPreview your build locally, before deploying
npm run astro ...Run CLI commands like astro add, astro check
npm run astro -- --helpGet help using the Astro CLI

💼 Explore my personal work and projects:

Visit my portfolio at Bhargav Patel to explore my work, projects, and what I’ve been building lately.

🪪 License

MIT

Keywords

astro

FAQs

Package last updated on 10 Jun 2025

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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.