### Preload Example
Source: https://github.com/joshbuchea/head/blob/master/_autodocs/link-tags.md
Fetches resources needed for the current page with high priority. Requires the 'as' attribute to specify the resource type.
```html
```
```html
```
--------------------------------
### Preconnect Example
Source: https://github.com/joshbuchea/head/blob/master/_autodocs/link-tags.md
Establishes an early connection to a domain, including DNS resolution, TCP handshake, and TLS negotiation. Use for critical cross-origin resources.
```html
```
```html
```
```html
```
--------------------------------
### oEmbed JSON Response Example
Source: https://github.com/joshbuchea/head/blob/master/_autodocs/social-tags.md
Example of a JSON response from an oEmbed endpoint. Contains metadata for embedding content like photos, videos, or links.
```json
{
"type": "photo|video|link|rich",
"version": "1.0",
"provider_name": "Provider",
"provider_url": "https://example.com",
"title": "Resource title",
"author_name": "Author",
"author_url": "https://example.com/author",
"width": 1200,
"height": 630,
"url": "https://example.com/embed-url"
}
```
--------------------------------
### Prefetch Example
Source: https://github.com/joshbuchea/head/blob/master/_autodocs/link-tags.md
Fetches resources that might be needed for the next page visit with very low priority. Useful for pagination or expected next steps.
```html
```
```html
```
--------------------------------
### DNS Prefetch Example
Source: https://github.com/joshbuchea/head/blob/master/_autodocs/link-tags.md
Instructs the browser to perform DNS lookups for a domain in the background, improving subsequent resource loading times. Useful for third-party domains.
```html
```
```html
```
--------------------------------
### Strict Content Security Policy Example
Source: https://github.com/joshbuchea/head/blob/master/_autodocs/security-best-practices.md
An example of a comprehensive CSP meta tag with multiple directives to enforce strict security policies across various resource types.
```html
```
--------------------------------
### Web App Manifest JSON Configuration
Source: https://github.com/joshbuchea/head/blob/master/_autodocs/platform-specific.md
Example JSON structure for a Web App Manifest, defining application name, display modes, icons, and shortcuts.
```json
{
"name": "Full Application Name",
"short_name": "App",
"description": "Description of the app",
"start_url": "/",
"scope": "/",
"display": "standalone",
"orientation": "portrait-primary",
"theme_color": "#4285F4",
"background_color": "#FFFFFF",
"categories": ["productivity"],
"icons": [
{
"src": "/icon-192x192.png",
"sizes": "192x192",
"type": "image/png",
"purpose": "any"
},
{
"src": "/icon-512x512.png",
"sizes": "512x512",
"type": "image/png",
"purpose": "any"
},
{
"src": "/icon-maskable.png",
"sizes": "192x192",
"type": "image/png",
"purpose": "maskable"
}
],
"screenshots": [
{
"src": "/screenshot-1x.png",
"sizes": "540x720",
"type": "image/png",
"form_factor": "narrow"
}
],
"shortcuts": [
{
"name": "Quick Action",
"short_name": "Quick",
"description": "Perform quick action",
"url": "/quick-action",
"icons": [
{
"src": "/shortcut-icon.png",
"sizes": "96x96"
}
]
}
]
}
```
--------------------------------
### Optimized HTML Head Structure
Source: https://github.com/joshbuchea/head/blob/master/_autodocs/recommended-patterns.md
This example demonstrates an optimized HTML
structure incorporating critical CSS, DNS prefetching, preconnect, preloading, and deferred scripts for maximum performance.
```html
Page Title
```
--------------------------------
### Async Script Timing Example
Source: https://github.com/joshbuchea/head/blob/master/_autodocs/scripts-styles.md
Demonstrates the difference between blocking, async, and defer script loading. Async scripts load and execute independently, while defer scripts execute after HTML parsing is complete, both in parallel with parsing.
```html
Page
Page Content
```
--------------------------------
### Generate SRI Hash using OpenSSL
Source: https://github.com/joshbuchea/head/blob/master/_autodocs/scripts-styles.md
Command-line example using OpenSSL to generate a Subresource Integrity (SRI) hash for a JavaScript file.
```bash
# Using openssl
openssl dgst -sha384 -binary file.js | openssl enc -base64 -A
```
--------------------------------
### Progressive Web App (PWA) Head
Source: https://github.com/joshbuchea/head/blob/master/_autodocs/recommended-patterns.md
Use this head section for installable web applications to configure PWA features, icons, and manifest.
```html
App Name
```
```json
{
"name": "Full Application Name",
"short_name": "App",
"description": "App description",
"start_url": "/",
"scope": "/",
"display": "standalone",
"orientation": "portrait-primary",
"theme_color": "#4285F4",
"background_color": "#FFFFFF",
"icons": [
{
"src": "/icon-192x192.png",
"sizes": "192x192",
"type": "image/png"
},
{
"src": "/icon-512x512.png",
"sizes": "512x512",
"type": "image/png"
}
]
}
```
--------------------------------
### Pinterest Example: Disable Pinning with Message
Source: https://github.com/joshbuchea/head/blob/master/_autodocs/social-tags.md
Example of using the Pinterest meta tag to disable pinning and provide a custom message explaining why.
```html
```
--------------------------------
### Windows Tiles & Browserconfig Configuration
Source: https://github.com/joshbuchea/head/blob/master/_autodocs/deprecated-elements.md
This meta tag was used to configure Windows 10 tiles for a website. It is obsolete as live tiles were removed from the Windows 11 Start menu.
```html
```
--------------------------------
### Generate SRI Hash using npm package
Source: https://github.com/joshbuchea/head/blob/master/_autodocs/scripts-styles.md
Command-line example using the 'sri' npm package to generate a Subresource Integrity (SRI) hash for a JavaScript file.
```bash
# Using npm
npm install -g sri
sri --file file.js
```
--------------------------------
### Google JSON-LD for Organization
Source: https://github.com/joshbuchea/head/blob/master/_autodocs/social-tags.md
Example of JSON-LD markup for an organization, specifically for Google Knowledge Graph results. Includes brand, contact, and social media details.
```html
```
--------------------------------
### Script Integrity (SRI) Example
Source: https://github.com/joshbuchea/head/blob/master/_autodocs/scripts-styles.md
Loads an external script with Subresource Integrity (SRI) attributes to ensure the script has not been tampered with. Requires a hash and crossorigin attribute.
```html
```
--------------------------------
### Schema.org JSON-LD Format for NewsArticle
Source: https://github.com/joshbuchea/head/blob/master/_autodocs/social-tags.md
Example of JSON-LD markup for a NewsArticle, including multiple image URLs and author details.
```html
```
--------------------------------
### Standard JavaScript Script Type
Source: https://github.com/joshbuchea/head/blob/master/_autodocs/scripts-styles.md
Example of a standard script tag with type 'text/javascript', which is the default and not explicitly required.
```html
```
--------------------------------
### App Links Web Fallback Configuration
Source: https://github.com/joshbuchea/head/blob/master/README.md
Provides a web URL as a fallback for App Links when the app is not installed. This ensures users can still access content via a web browser.
```html
```
--------------------------------
### Android Web App Installation
Source: https://github.com/joshbuchea/head/blob/master/_autodocs/platform-specific.md
Enable the 'Add to Home Screen' feature for Android Chrome and set the application name using 'mobile-web-app-capable' and 'application-name' meta tags.
```html
```
```html
```
--------------------------------
### Resource Hint Links
Source: https://github.com/joshbuchea/head/blob/master/README.md
Used for prefetching, preloading, and preconnecting to resources. These hints help improve performance by preparing resources in advance.
```html
```
```html
```
```html
```
--------------------------------
### HTML Template Script Type
Source: https://github.com/joshbuchea/head/blob/master/_autodocs/scripts-styles.md
Example of using a script tag with type 'text/html' to hold client-side templates, which are not executed but can be processed by JavaScript.
```html
```
--------------------------------
### Execution Order with Async Scripts
Source: https://github.com/joshbuchea/head/blob/master/_autodocs/scripts-styles.md
Illustrates that multiple async scripts may execute out of their declared order, as they run as soon as they are downloaded.
```html
```
--------------------------------
### JSON Data Script Type
Source: https://github.com/joshbuchea/head/blob/master/_autodocs/scripts-styles.md
Example of embedding JSON data within a script tag, marked with 'application/json'. This content is not executed as JavaScript.
```html
```
--------------------------------
### E-Learning Platform Head
Source: https://github.com/joshbuchea/head/blob/master/_autodocs/recommended-patterns.md
Includes meta tags for character set and viewport, title, description, Open Graph tags for social sharing, and structured data (JSON-LD) for Course schema. Also includes links to CSS and JS files.
```html
Course Title | Learning Platform
```
--------------------------------
### Recommended Minimum HTML Head Elements
Source: https://github.com/joshbuchea/head/blob/master/README.md
Essential meta tags for character encoding and viewport settings should be placed as early as possible in the for consistent document rendering.
```html
Page Title
```
--------------------------------
### Privacy-Preserving Resource Hints
Source: https://github.com/joshbuchea/head/blob/master/_autodocs/security-best-practices.md
Utilize privacy-preserving resource hints like 'dns-prefetch' and 'preconnect'. 'dns-prefetch' is less impactful on privacy than 'preconnect'.
```html
```
--------------------------------
### Document External Dependencies with SRI
Source: https://github.com/joshbuchea/head/blob/master/_autodocs/security-best-practices.md
When using external scripts or stylesheets, always document their sources and include integrity hashes for verification.
```html
```
--------------------------------
### Apple iOS Launch Icon and Startup Image
Source: https://github.com/joshbuchea/head/blob/master/README.md
Specify the path to your app's launch icon and startup image for iOS devices.
```html
```
--------------------------------
### LD-JSON Structured Data Script Type
Source: https://github.com/joshbuchea/head/blob/master/_autodocs/scripts-styles.md
Example of embedding JSON-LD structured data within a script tag, marked with 'application/ld+json', for search engines and other consumers.
```html
```
--------------------------------
### CSP Nonce Implementation for Inline Scripts
Source: https://github.com/joshbuchea/head/blob/master/_autodocs/security-best-practices.md
Demonstrates how to use a nonce to allow specific inline scripts. The nonce must be generated server-side and included in both the CSP header and the script tag.
```html
```
```http
Content-Security-Policy: script-src 'nonce-random-abc123xyz'
```
--------------------------------
### Script Loading - Async and Defer
Source: https://github.com/joshbuchea/head/blob/master/README.md
Combines 'async' and 'defer'. 'async' takes precedence in modern browsers, while 'defer' acts as a fallback for older browsers.
```html
```
--------------------------------
### Basic Script Loading
Source: https://github.com/joshbuchea/head/blob/master/_autodocs/scripts-styles.md
Demonstrates how to load external script files and embed inline scripts. External scripts block HTML parsing by default.
```html
```
--------------------------------
### Preload vs. DNS-Prefetch for Performance and Privacy
Source: https://github.com/joshbuchea/head/blob/master/_autodocs/security-best-practices.md
Use `dns-prefetch` for lighter-touch domain hinting compared to `preload`, which can leak more information.
```html
```
--------------------------------
### Recommended Order of HTML Head Elements
Source: https://github.com/joshbuchea/head/blob/master/README.md
Follow this order for elements in the to ensure optimal performance and correct rendering, prioritizing encoding, viewport, title, meta tags, links, and scripts.
```html
Page Title
```
--------------------------------
### Web App Manifest Link
Source: https://github.com/joshbuchea/head/blob/master/_autodocs/platform-specific.md
Link to the Web App Manifest file, which is the recommended approach for PWA configuration across platforms.
```html
```
--------------------------------
### Favicon and Touch Icon Configuration
Source: https://github.com/joshbuchea/head/blob/master/README.md
Configure favicons and touch icons for different browser and device resolutions. Place favicon.ico in the root directory for older browsers.
```html
```
--------------------------------
### Deferred Stylesheet + Inline Critical Path
Source: https://github.com/joshbuchea/head/blob/master/_autodocs/scripts-styles.md
Load critical CSS inline for initial rendering and defer non-critical stylesheets to improve perceived performance. Use `media='print'` and `onload='this.media="all"'` for deferred loading, with a `noscript` fallback.
```html
```
--------------------------------
### Recommended Complete HTML Head Structure
Source: https://github.com/joshbuchea/head/blob/master/_autodocs/head-elements.md
A comprehensive HTML head structure including metadata, social sharing tags, canonical URL, resource hints, stylesheets, icons, and deferred scripts.
```html
Page Title
```
--------------------------------
### Execution Order with Defer Scripts
Source: https://github.com/joshbuchea/head/blob/master/_autodocs/scripts-styles.md
Shows that defer scripts execute in the order they appear in the HTML, ensuring predictable execution after parsing.
```html
```
--------------------------------
### Windows Tiles Meta Tag (Legacy)
Source: https://github.com/joshbuchea/head/blob/master/_autodocs/platform-specific.md
Configure Windows 10 tiles using the msapplication-config meta tag. This is no longer used in Windows 11.
```html
```
--------------------------------
### Windows Tiles Configuration Meta Tag
Source: https://github.com/joshbuchea/head/blob/master/DEPRECATED.md
Specifies the configuration file for Windows Tiles, used for live tile integration. This tag is specific to Internet Explorer and Windows integration.
```html
```
--------------------------------
### Use Nonces for Inline Scripts
Source: https://github.com/joshbuchea/head/blob/master/_autodocs/security-best-practices.md
Employ nonces with inline scripts to allow them while still enforcing CSP, balancing performance and security.
```html
```
--------------------------------
### Explicit DNS Prefetch and Preconnect Hints
Source: https://github.com/joshbuchea/head/blob/master/_autodocs/deprecated-elements.md
These link relations are used to explicitly control DNS prefetching and establish early connections to domains, replacing the deprecated DNS prefetch control meta tag.
```html
```
--------------------------------
### QQ Mobile Browser Meta Tags
Source: https://github.com/joshbuchea/head/blob/master/_autodocs/platform-specific.md
Configure screen orientation, fullscreen display, and application mode for QQ Mobile Browser.
```html
```
--------------------------------
### Pingback vs. Webmention Link Tags
Source: https://github.com/joshbuchea/head/blob/master/_autodocs/deprecated-elements.md
Compares the deprecated Pingback XML-RPC link tag with the modern Webmention link tag.
```html
```
--------------------------------
### Preload Link
Source: https://github.com/joshbuchea/head/blob/master/README.md
Instructs the browser to fetch a resource early in the page lifecycle. Specify the href and the 'as' attribute (e.g., 'image', 'script').
```html
```
--------------------------------
### QQ Mobile Browser Application Mode
Source: https://github.com/joshbuchea/head/blob/master/README.md
Configures the document to display in application mode (fullscreen, etc.) for QQ Mobile Browser. This provides a more app-like experience.
```html
```
--------------------------------
### Async Script Loading
Source: https://github.com/joshbuchea/head/blob/master/_autodocs/scripts-styles.md
Loads an external script in parallel with HTML parsing. The script executes as soon as it's downloaded, without guaranteed order relative to other async scripts.
```html
```
--------------------------------
### Recommended HTML Head Structure
Source: https://github.com/joshbuchea/head/blob/master/_autodocs/scripts-styles.md
A structured `` including essential meta tags, title, critical CSS, external stylesheets, font preloading, and deferred scripts for optimal performance and SEO.
```html
Page Title
```
--------------------------------
### File Organization Structure
Source: https://github.com/joshbuchea/head/blob/master/_autodocs/README.md
This snippet displays the directory structure of the HEAD project, illustrating the organization of markdown files for different aspects of HTML head element documentation.
```text
/workspace/home/output/
├── README.md (this file)
├── index.md (navigation & quick reference)
├── head-elements.md (element specifications)
├── meta-tags.md (meta tag catalog)
├── link-tags.md (link relationships)
├── social-tags.md (Open Graph, Schema.org, etc.)
├── platform-specific.md (iOS, Android, PWA)
├── scripts-styles.md (JavaScript & CSS)
├── recommended-patterns.md (production templates)
├── deprecated-elements.md (historical reference)
└── security-best-practices.md (security guide)
```
--------------------------------
### BrowserConfig XML for Windows Tiles
Source: https://github.com/joshbuchea/head/blob/master/DEPRECATED.md
Minimum required XML markup for the browserconfig.xml file to define Windows Tiles. This file configures the appearance and icons for live tiles.
```xml
```
--------------------------------
### Web Monetization Meta Tag
Source: https://github.com/joshbuchea/head/blob/master/README.md
Implements the Web Monetization API, allowing for micropayments to content creators. Requires a payment pointer.
```html
```
--------------------------------
### Standard Optimized Page (New for AMP Replacement)
Source: https://github.com/joshbuchea/head/blob/master/_autodocs/deprecated-elements.md
This represents the modern approach to mobile optimization, which involves directly optimizing core web vitals without requiring a separate AMP-specific link tag.
```html
```
--------------------------------
### Force HTTPS with CSP upgrade-insecure-requests
Source: https://github.com/joshbuchea/head/blob/master/_autodocs/security-best-practices.md
Use the Content Security Policy (CSP) 'upgrade-insecure-requests' directive to automatically upgrade all insecure HTTP requests to HTTPS.
```html
```
--------------------------------
### BrowserConfig XML Structure (Obsolete)
Source: https://github.com/joshbuchea/head/blob/master/_autodocs/platform-specific.md
Defines the structure for the browserconfig.xml file used for legacy Windows tiles. This format is obsolete.
```xml
#0078D4
```
--------------------------------
### Basic Meta Tags for Document Rendering
Source: https://github.com/joshbuchea/head/blob/master/README.md
These meta tags should be placed early in the for consistent document rendering. They define character encoding and viewport settings.
```html
```
--------------------------------
### Dublin Core Metadata Elements
Source: https://github.com/joshbuchea/head/blob/master/README.md
Use these meta tags to declare Dublin Core metadata for resources. Ensure the DC namespace is declared using a link tag.
```html
```
--------------------------------
### Multiple Open Graph Images
Source: https://github.com/joshbuchea/head/blob/master/_autodocs/social-tags.md
Allows specifying multiple images for a preview, with the first image listed being the primary one.
```html
```
--------------------------------
### Recommended Webmention Link
Source: https://github.com/joshbuchea/head/blob/master/_autodocs/deprecated-elements.md
This HTML link tag is the modern replacement for pingbacks, used for decentralized comments via the Webmention standard.
```html
```
--------------------------------
### Standard Website HTML Head
Source: https://github.com/joshbuchea/head/blob/master/_autodocs/recommended-patterns.md
A comprehensive head template for typical websites, optimized for SEO and social sharing. Includes metadata, theme colors, Open Graph tags, canonical URL, resource hints, stylesheets, fonts, icons, PWA manifest, and deferred scripts.
```html
Page Title | Site Name
```
--------------------------------
### Blog/Article HTML Head with Schema.org
Source: https://github.com/joshbuchea/head/blob/master/_autodocs/recommended-patterns.md
A head template for blog posts and articles, including rich metadata for SEO and social sharing. Features Open Graph tags, canonical URL, and structured data in JSON-LD format for search engines.
```html
Article Title | Blog Name
```
--------------------------------
### Open Graph Audio Properties
Source: https://github.com/joshbuchea/head/blob/master/_autodocs/social-tags.md
Specifies properties for embedded audio previews, including secure URL and MIME type.
```html
```
--------------------------------
### Common HTML Head Elements
Source: https://github.com/joshbuchea/head/blob/master/README.md
This snippet illustrates various standard HTML elements including character encoding, title, base URL, external stylesheets, inline styles, and script tags.
```html
Page Title
```
--------------------------------
### License Link Tag
Source: https://github.com/joshbuchea/head/blob/master/_autodocs/link-tags.md
Links to copyright or license information for the content. This helps users understand usage rights.
```html
```
--------------------------------
### Open Search Link
Source: https://github.com/joshbuchea/head/blob/master/README.md
Links to an Open Search description file, enabling site search functionality. Specify the href and type.
```html
```
--------------------------------
### Basic Open Graph Tags
Source: https://github.com/joshbuchea/head/blob/master/_autodocs/social-tags.md
Essential Open Graph tags for defining the core properties of a shared webpage, including URL, type, title, description, image, site name, and locale.
```html
```
--------------------------------
### QQ / WeChat Share Preview Meta Tags
Source: https://github.com/joshbuchea/head/blob/master/_autodocs/social-tags.md
Meta tags for customizing the preview when sharing content on QQ and WeChat. Includes title, image, and description.
```html
```
--------------------------------
### Fediverse Creator Handle
Source: https://github.com/joshbuchea/head/blob/master/README.md
Specify your Fediverse handle for use in embeds. This requires additional configuration in your Fediverse software's settings.
```html
```
--------------------------------
### Web App Manifest JSON Structure
Source: https://github.com/joshbuchea/head/blob/master/_autodocs/link-tags.md
Defines the structure of a web app manifest file, including application name, icons, and display settings.
```json
{
"name": "My Web App",
"short_name": "MyApp",
"description": "Description",
"start_url": "/",
"display": "standalone",
"scope": "/",
"theme_color": "#4285F4",
"background_color": "#FFFFFF",
"icons": [
{
"src": "/icon-192.png",
"sizes": "192x192",
"type": "image/png"
}
]
}
```
--------------------------------
### Dublin Core Core Elements
Source: https://github.com/joshbuchea/head/blob/master/_autodocs/social-tags.md
HTML meta tags for core Dublin Core metadata elements. Used for describing resources.
```html
```