2.0 alpha
These docs describe 2.0. Install it with @once-ui-system/core@alpha.
On 1.8.x? Read the 1.x docs
TrademarkTrademarkDocs
Ctrl k
Search docs...
Hooks

useOgData

Updated: February 22, 2026
View on GitHub
The useOgData hook fetches Open Graph metadata from URLs, including title, description, image, and favicon. It automatically handles image proxying for external sources and provides loading states. Used in components: OGCard
  • Fetches OG metadata from any URL
  • Automatic image proxying for CORS-free display
  • Loading state management
  • Custom API endpoint support
  • Companion useOgImage hook for image-only fetching
Fetch and display Open Graph data: Use custom API routes for fetching and proxying: For cases where you only need the image: Combine with the OGCard component for rich previews:
Prop
Type
Default
url
stringnull
customFetchUrl
string'/api/og/fetch'
customProxyUrl
string'/api/og/proxy'
Prop
Type
Default
url
stringnull
customFetchUrl
string'/api/og/fetch'
customProxyUrl
string'/api/og/proxy'
This hook requires server-side API routes to function. Use the handleOGFetch and handleOGProxy utilities: The hook automatically proxies external images through your server to avoid CORS issues:
  • Images from the same origin are used directly
  • External images are routed through the proxy endpoint
  • The proxy adds appropriate cache headers
The hook handles errors gracefully:
  • Conditional fetching: Pass null as URL to skip fetching
  • Memoize URLs: Prevent unnecessary refetches
  • Cache responses: The proxy endpoint includes cache headers
Edit this page on GitHub
TrademarkTrademark
Built with curiosity by Lorant One and the Design Engineers Club