Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

@mannisto/astro-head

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
Package was removed
Sorry, it seems this package was removed from the registry

@mannisto/astro-head

Composable Astro components for managing your HTML <head> in Astro projects.

latest
Source
npmnpm
Version
1.0.4
Version published
Maintainers
1
Created
Source

Astro Head

A collection of composable Astro components for managing your HTML <head>: meta tags, favicons, Open Graph, Twitter cards, and more.

Table of Contents

ComponentPurpose
AuthorMeta author
CanonicalCanonical link
DescriptionMeta description
FaviconFavicon and touch icons
FollowRobots follow/nofollow
HeadAll-in-one head manager
IndexRobots index/noindex
KeywordsMeta keywords
LinkGeneric link elements
MetaGeneric meta elements
OpenGraphOpen Graph meta tags
ScriptScript elements
ThemeColorTheme color meta tag
TitlePage title with template support
TwitterTwitter card meta tags

Common Usecase

A common and recommended pattern is to let your Layout component manage your site's <head> tags using the Head component. This way, you can:

  • Set default values in your Layout.
  • Easily override these values from pages by passing props to the Layout.
  • Keep your page files clean and focused on content, while your Layout handles all head-related logic and defaults.

You can also pass custom elements (for example: analytics scripts) as children to the Head component in your layout. If your project uses multiple different layouts, consider creating a top-level Root layout that manages all the Head logic. This way, your Root layout can wrap your other layouts as children, keeping your head management consistent across the entire site.

Example:

---
// layouts/Layout.astro
import Head from "@mannisto/Head.astro";

interface Props {
  title?: string
  description?: string
  keywords?: string[]
  // Other props you want to make configurable from pages
}
const {
  title = "Default Title",
  description = "Default description foo faa lorem ipsum",
  keywords = ["Default", "Keywords"]
} = Astro.props;
---

<!DOCTYPE html>
<html lang="en">
  <Head
    title={title}
    template="%s | Acme Studio"
    description={description}
    image="/images/social-banner.jpg"
    keywords={keywords}
    author="Acme Studio"
    themeColor="#1a1a1a"
  >
    <script src="https://faa-analytics.example?id=123456"></script>
    <script src="https://foo-analytics.example?id=123456"></script>
  </Head>
  <body>
    <slot/>
  </body>
</html>
---
// pages/index.astro
import Layout from "../layouts/Layout.astro"
---

<Layout 
  title="Homepage" 
  description="Welcome to my foo faa lorem ipsum"
>
  <!-- My page content ... -->
</Layout>

Author

PropTypeDescriptionDefault
valuestringAuthor name/contentundefined

Passed as a prop

<Head author="Jane Doe" />

Used as a standalone component

---
import Head from "@mannisto/Author.astro";
---

<Author value="Jane Doe" />

Canonical

PropTypeDescriptionDefault
valuestringCanonical URLundefined

Passed as a prop

<Head canonical="https://example.com/page" />

Used as a standalone component

---
import Head from "@mannisto/Canonical.astro";
---

<Canonical value="https://example.com/page" />

Description

PropTypeDescriptionDefault
valuestringMeta descriptionundefined

Passed as a prop

<Head description="A page description." />

Used as a standalone component

<Description value="A page description." />

Favicon

PropTypeDescriptionDefault
faviconsFaviconLink[]Array of favicon configsfavicon.ico

By default the app expects one favicon.ico file in the root of the public folder, if the prop is left empty. Preset options are ico, png, svg, or apple.

Passed as a prop

<Head
  favicons={[
    { preset: "ico",   href: "/favicon/favicon.ico"                     },
    { preset: "png",   href: "/favicon/favicon-16.png",       size: 16  },
    { preset: "png",   href: "/favicon/favicon-32.png",       size: 32  },
    { preset: "png",   href: "/favicon/favicon-192.png",      size: 192 },
    { preset: "png",   href: "/favicon/favicon-512.png",      size: 512 },
    { preset: "apple", href: "/favicon/apple-touch-icon.png", size: 180 }
  ]}
/>

Used as a standalone component

---
import Head from "@mannisto/Favicon.astro";
---

<Favicon icons={[
  { preset: "ico", href: "favicon.ico" },
]} />

Follow

PropTypeDescriptionDefault
valuebooleanAllow following linksundefined

Passed as a prop

<Head follow={true} />

Used as a standalone component

---
import Head from "@mannisto/Follow.astro";
---

<Follow value={true} />

Head

The Head component is the main component that handles all head elements in one place.

PropTypeDescriptionDefault
titlestringPage title"Untitled"
templatestringTitle template with %s placeholderundefined
descriptionstringMeta descriptionundefined
imagestringSocial sharing image URLundefined
keywordsstring[]Meta keywords arrayundefined
indexbooleanAllow search engine indexingtrue
followbooleanAllow following linkstrue
canonicalstringCanonical URLundefined
authorstringPage authorundefined
themeColorstringBrowser theme colorundefined
faviconsFaviconLink[]Array of favicon configurations"favicon.ico"
---
import Head from "@mannisto/Head.astro";
---

<Head
  title="About Us"
  template="%s | Acme Studio"
  description="Learn about our company and mission"
  image="/images/social-banner.jpg"
  keywords={["company", "about", "mission"]}
  index={true}
  follow={true}
  canonical="https://example.com/about"
  author="Acme Studio"
  themeColor="#1a1a1a"
  favicons={[
    { icon: "ico",   href: "/favicon/favicon.ico"                     },
    { icon: "png",   href: "/favicon/favicon-16.png",       size: 16  },
    { icon: "png",   href: "/favicon/favicon-32.png",       size: 32  },
    { icon: "png",   href: "/favicon/favicon-192.png",      size: 192 },
    { icon: "png",   href: "/favicon/favicon-512.png",      size: 512 },
    { icon: "apple", href: "/favicon/apple-touch-icon.png", size: 180 }
  ]}
/>

Index

PropTypeDescriptionDefault
valuebooleanAllow search engine indexingundefined

Passed as a prop

<Head index={true} />

Used as a standalone component

---
import Head from "@mannisto/Index.astro";
---

<Index value={true} />

Keywords

PropTypeDescriptionDefault
valuestring[]Meta keywords arrayundefined

Passed as a prop

<Head keywords={["astro", "web", "components"]} />

Used as a standalone component

---
import Head from "@mannisto/Keywords.astro";
---

<Keywords value={["astro", "web", "components"]} />

PropTypeDescriptionDefault
relstringLink relationshipundefined
hrefstringLink URL or pathundefined
asstringResource type for preload, etc.undefined
blockingstringBlocking tokensundefined
crossoriginstringCORS settingundefined
disabledbooleanDisable stylesheetundefined
fetchprioritystringFetch priorityundefined
hreflangstringLanguage of resourceundefined
imagesizesstringPreload image sizesundefined
imagesrcsetstringPreload image srcsetundefined
integritystringSubresource integrityundefined
mediastringMedia queryundefined
referrerpolicystringReferrer policyundefined
sizesstringIcon sizesundefined
titlestringAlternate stylesheet titleundefined
typestringMIME typeundefined
[key]anyAny additional custom attributesundefined

Passed as a prop

<Head
  links={[
    { rel: "icon", href: "/favicon-32.png", type: "image/png", sizes: "32x32" },
    { rel: "stylesheet", href: "https://cdn.example.com/fonts/fake-font.css" },
    { rel: "preconnect", href: "https://fonts.example.com", crossorigin: "anonymous" }
  ]}
/>

Used as a standalone component

---
import Head from "@mannisto/Link.astro";
---

<Link rel="icon" href="/favicon-32.png" type="image/png" sizes="32x32" />
<Link rel="stylesheet" href="https://cdn.example.com/fonts/fake-font.css" />
<Link rel="preconnect" href="https://fonts.example.com" crossorigin="anonymous" />

Meta

PropTypeDescriptionDefault
charsetstringCharacter encoding"utf-8"
contentstringValue of the meta tagundefined
httpEquivstringHTTP header equivalentundefined
mediastringMedia query for the meta tagundefined
namestringName of the meta tagundefined
propertystringProperty (for OpenGraph, etc.)undefined
[key]anyAny additional custom attributesundefined

Passed as a prop

<Head 
  meta={[
    { name: "viewport", content: "width=device-width, initial-scale=1" },
    { httpEquiv: "X-UA-Compatible", content: "IE=edge" }
  ]}
/>

Used as a standalone component

---
import Head from "@mannisto/Meta.astro";
---

<Meta name="viewport" content="width=device-width, initial-scale=1" />
<Meta httpEquiv="X-UA-Compatible" content="IE=edge" />

OpenGraph

PropTypeDescriptionDefault
titlestringOpen Graph titleundefined
descriptionstringOpen Graph descriptionundefined
imagestringOpen Graph image URLundefined
urlstringOpen Graph URLundefined
typestringOpen Graph type"website"

If you use the Head component and do not provide OpenGraph props, it will automatically use the page's title, description, canonical URL, and image. You can override any of these by passing an openGraph prop to Head.

Passed as a prop

<Head openGraph={{ 
  title: "About Us", 
  description: "Learn about our company", 
  image: "/banner.png", 
  url: "https://example.com/about" 
}} />

Used as a standalone component

---
import Head from "@mannisto/OpenGraph.astro";
---

<OpenGraph 
  title="About Us" 
  description="Learn about our company" 
  image="/banner.png" 
  url="https://example.com/about" 
/>

Script

PropTypeDescriptionDefault
srcstringScript source URLundefined
typestringScript MIME typeundefined
asyncbooleanLoad script asynchronouslyundefined
deferbooleanDefer script executionundefined
crossoriginstringCORS settingundefined
integritystringSubresource integrityundefined
attributionsrcstringAttribution reporting sourceundefined
blockingstringBlocking tokensundefined
fetchprioritystringFetch priorityundefined
nomodulebooleanOnly for browsers without modulesundefined
noncestringCryptographic nonceundefined
referrerpolicystringReferrer policyundefined

Passed as a prop

<Head
  scripts={[
    { src: "https://cdn.example.com/analytics.js", async: true },
    { content: "console.log('Hello from inline module!')", type: "module" }
  ]}
/>

Used as a standalone component

---
import Head from "@mannisto/Script.astro";
---

<Script src="https://cdn.example.com/analytics.js" async />
<Script type="module">console.log('Hello from inline module!')</Script>

ThemeColor

PropTypeDescriptionDefault
valuestringTheme colorundefined

Passed as a prop

<Head themeColor="#ffffff" />

Used as a standalone component

---
import Head from "@mannisto/ThemeColor.astro";
---

<ThemeColor value="#ffffff" />

Title

PropTypeDescriptionDefault
valuestringPage titleundefined
templatestringTitle template with %s"%s"

Passed as a prop

<Head title="About Us" template="%s | Acme Studio" />

Used as a standalone component

---
import Head from "@mannisto/Title.astro";
---

<Title value="About Us" template="%s | Acme Studio" />

Twitter

PropTypeDescriptionDefault
titlestringTwitter card titleundefined
descriptionstringTwitter card descriptionundefined
imagestringTwitter card image URLundefined
cardstringCard type"summary_large_image"

If you use the Head component and do not provide Twitter props, it will automatically fall back to the page's title, description, and image. You can override any of these by passing a twitter prop to Head.

Passed as a prop

<Head twitter={{ 
  title: "About Us", 
  description: "Learn about our company", 
  image: "/twitter-og.jpg", 
  card: "summary" 
}} />

Used as a standalone component

---
import Head from "@mannisto/Twitter.astro";
---

<Twitter 
  title="About Us" 
  description="Learn about our company" 
  image="/twitter-og.jpg" 
  card="summary" 
/>

Keywords

astro

FAQs

Package last updated on 16 Jul 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