Skip to content

AppleItunesApp

AppleItunesApp renders the <meta name="apple-itunes-app"> tag that iOS Safari uses to display a Smart App Banner at the top of the browser, linking visitors to an App Store application.

Use either content OR id/argument, not both.

proptypedefaultrequireddescription
contentstring-NoDirect content string for the meta tag. When provided, id and argument are ignored.
proptypedefaultrequireddescription
idstring-NoThe App Store application ID. No tag is rendered when omitted.
argumentstring-NoA URL or deep-link argument passed to the app when the banner is tapped.

Input:

<AppleItunesApp id="123456789" />

Output:

<meta name="apple-itunes-app" content="app-id=123456789" />

Uses the integration headTags.appleItunesApp value when no prop is provided.

Input:

// in astro.config.mjs integration config
eminence({
headTags: {
appleItunesApp: {
id: "123456789",
argument: "myapp://open",
},
},
});
<AppleItunesApp />

Output:

<meta
name="apple-itunes-app"
content="app-id=123456789, app-argument=myapp://open"
/>

Input:

<AppleItunesApp id="123456789" argument="myapp://open" />

Output:

<meta
name="apple-itunes-app"
content="app-id=123456789, app-argument=myapp://open"
/>

Input:

<AppleItunesApp content="app-id=123456789, app-argument=myapp://open" />

Output:

<meta
name="apple-itunes-app"
content="app-id=123456789, app-argument=myapp://open"
/>

The component accepts either a content prop or id/argument props. Mixing both patterns is intentionally disallowed so there is a single source of truth for the generated content value.

This component intentionally renders only apple-itunes-app. Related Apple tags (for example apple-mobile-web-app-capable and startup/status-bar tags) are intentionally excluded. See unsupported tags for more information. You should probably use a manifest instead for those.

---
import config from "virtual:eminence-astro-suite/head-tags";
import { hasAnyProp } from "../utils";
type Props =
| {
/**
* Use when you already have a fully built Smart App Banner content string.
* Prefer this for custom ordering/values; do not combine with `id` or `argument`.
*/
content: string;
id?: never;
argument?: never;
}
| {
/**
* App Store application ID used to build `app-id=<id>`.
* Required when not using `content`.
*/
id: string;
/**
* Optional deep-link/URL appended as `app-argument=<argument>`.
* Use when opening a specific in-app route is desired.
*/
argument?: string;
content?: never;
}
| { content?: never; id?: never; argument?: never };
const { id, argument, content } = (
hasAnyProp(Astro.props) ? Astro.props : (config.appleItunesApp ?? {})
) as Props;
---
{content && <meta name="apple-itunes-app" content={content} />}
{
id && (
<meta
name="apple-itunes-app"
content={[`app-id=${id}`, argument && `app-argument=${argument}`]
.filter(Boolean)
.join(", ")}
/>
)
}