
Isomorphic way to manipulate document.head for Meteor apps
DocHead is a powerful tool designed specifically for Meteor applications that offers a seamless way to manipulate the document.head, simplifying the management of page titles and meta tags. Its isomorphic nature enables developers to set these dynamic elements on both the client and server sides using a unified API. This makes it an essential resource for anyone looking to enhance their Meteor app’s SEO and user experience with minimal effort.
The installation is straightforward, and once integrated, DocHead can be utilized throughout your application. On the client side, you can access its features freely, while on the server side, it requires incorporation within a React component. This thoughtful design ensures that both environments can effectively utilize the same functionality without additional complexity.
Set Page Title: Use DocHead.setTitle(titleName) to easily update the page title, ensuring it reflects the current content.
Get Page Title: Retrieve the current document title with DocHead.getTitle(), which is reactive on the client, responding to any title changes made.
Add Meta Tags: Enhance your SEO by adding meta tags with DocHead.addMeta(metaInfo), allowing for better search engine indexing.
Add Link Tags: Include link tags to your document head with DocHead.addLink(metaInfo), perfect for adding resources like stylesheets.
Ld-Json Script: Inject structured data into your page using DocHead.addLdJsonScript(jsonObj), helping search engines understand your content better.
Dynamic Script Loading: Dynamically load scripts on the client side with DocHead.loadScript(scriptName, options, callback), providing flexibility in managing dependencies.
Cleanup Tags: Keep your document head tidy with DocHead.removeDocHeadAddedTags(), which removes older tags before a route change, ensuring that only the most relevant tags are present.
Server Integration: Designed to work with FlowRouter SSR on the server side, thus enhancing compatibility within the Meteor framework while maintaining a smooth user experience.
