npm install @alepha/react
Fill <head> server & client side.
Generate SEO-friendly meta tags and titles for your React application using AlephaReactHead module.
This module provides services and primitives to manage the document head both on the server and client side, ensuring that your application is optimized for search engines and social media sharing.
Primitives are functions that define and configure various aspects of your application. They follow the convention of starting with $ and return configured primitive instances.
For more details, see the Primitives documentation.
Set global <head> options for the application.
Hooks provide a way to tap into various lifecycle events and extend functionality. They follow the convention of starting with use and return configured hook instances.
1const App = () => { 2 const [head, setHead] = useHead({ 3 // will set the document title on the first render 4 title: "My App", 5 }); 6 7 return ( 8 // This will update the document title when the button is clicked 9 <button onClick={() => setHead({ title: "Change Title" })}>10 Change Title {head.title}11 </button>12 );13}
Providers are classes that encapsulate specific functionality and can be injected into your application. They handle initialization, configuration, and lifecycle management.
For more details, see the Providers documentation.
Browser-side head provider that manages document head elements.
Used by ReactBrowserProvider and ReactBrowserRouterProvider to update document title, meta tags, and other head elements during client-side navigation.
Provides methods to fill and merge head information into the application state.
Used both on server and client side to manage document head.
Server-side head provider that fills head content from route configurations.
Used by ReactServerProvider to collect title, meta tags, and other head elements which are then rendered by ReactServerTemplateProvider.