Metadata
Learn how to add metadata to your pages for better SEO and social sharing.
What is Metadata?
Metadata provides information about your webpage to search engines, social media platforms, and browsers. In Bini.js, you can export a metadata object from any layout to control page titles, descriptions, Open Graph tags, Twitter cards, and icons.
Metadata is essential for SEO and social sharing, helping your pages look great when shared on platforms like Twitter, Facebook, and LinkedIn.
Basic Metadata
Export a metadata object from your root layout or any nested layout:
| Field | Description |
|---|---|
| title | Page title shown in browser tab and search results |
| description | Page description for search results |
| viewport | Viewport configuration for responsive design |
| themeColor | Browser UI theme color |
| charset | Character encoding |
| robots | Instructions for search engine crawlers |
| manifest | Path to web app manifest |
| keywords | Array or string of keywords |
| authors | Author information |
| canonical | Canonical URL for SEO |
Open Graph
Open Graph tags control how your page appears when shared on social media platforms like Facebook, LinkedIn, and Slack.
| Field | Description |
|---|---|
| title | Title for social sharing |
| description | Description for social sharing |
| url | Canonical URL for the page |
| type | Type of content (website, article, etc.) |
| images | Array of image objects for social cards |
| siteName | Name of the site |
| locale | Language locale |
Twitter Cards
Twitter Cards control how your page appears when shared on Twitter/X.
| Field | Description |
|---|---|
| card | Card type (summary, summary_large_image, app, player) |
| title | Title for Twitter card |
| description | Description for Twitter card |
| creator | Twitter handle of the content creator |
| images | Array of image URLs for the card |
Default Images
Bini.js comes with default images pre-configured. Just replace these files in your public/ directory:
No configuration needed. Bini.js already has all the metadata configured. Just drop your images in the public/ folder and they'll automatically be used.
Tip: For best results, use images that are at least 1200x630 pixels for Open Graph images.
Icons
Define favicons, Apple touch icons, and other icons for your application.
| Field | Description |
|---|---|
| icon | Standard favicon (array of icon objects) |
| shortcut | Shortcut icon URL |
| apple | Apple touch icons (array of icon objects) |
Nested Metadata
Nested layouts can export their own metadata. Page titles are automatically combined using the template defined in the root layout.
When nested layouts export metadata, the title is automatically combined with the root layout's template. Other fields like description, openGraph, and twitter override ancestor values.