KNOWLEDGEBASE

Enabling MediaOS Hub

MediaOS Hub provides a streamlined way to link directly to embeddable tools like login forms, registration, profiles, and more—without creating dedicated pages. This is ideal for fast deployment of MediaOS components across your site.

What Is MediaOS Hub? #

MediaOS Hub is a lightweight router that allows you to display embeddable MediaOS components (like <mediaos-login-form>, <mediaos-register-form>, and others) by linking directly to a Hub route, such as:

https://yourdomain.com/hub/login-form

It eliminates the need to create separate template pages for each feature. You simply link to the Hub route, and the corresponding component loads dynamically.

Enabling MediaOS Hub #

To activate MediaOS Hub on your site, you need to include the following values in your window.mediaos JavaScript object.

<script>
  window.mediaos = {
    mediaos_version: 2,
    hub_enabled: true
  };
</script>

Note: mediaos_version must be set to 2 in order for Hub functionality to be recognized.

Secondly, you must have a page created with the route of https://yoursite.com/hub/. Your site will need to ignore anything after /hub/ and display the hub page. This can be done via a .htaccess if using apache web server or custom code in your CMS.

Next include the following code in the center of the page:

<mediaos-hub></mediaos-hub>

Tip: You can still include all normal window.mediaos metadata (like post_id, title, etc.) alongside the hub_enabled flag.

Required: Create a /hub/ Page Route #

In order for MediaOS Hub to function correctly, you must create a page with the route:

https://yoursite.com/hub/

This page acts as a container for all dynamically loaded Hub components (e.g., login forms, user profiles, comment feeds).

Important: Your site must be configured to ignore everything after /hub/ and always render the /hub/ page.

Implementation Options #

✅ If You’re Using Apache #

Add the following to your .htaccess file to rewrite any route under /hub/ back to the main Hub page.

RewriteEngine On
RewriteRule ^hub/.*$ /hub/ [L]

If You’re Using a CMS or Custom Framework #

Update your routing logic to:

  • Detect if the path begins with /hub/.
  • Always serve the base /hub/ page regardless of any additional path or query parameters.

Tip: This setup ensures that URLs like /hub/login-form or /hub/user-profile don’t require physical pages—they’ll be dynamically handled by the Hub system.

Example Usage #

Let’s say you want to display the MediaOS login form without building a custom page. Just link users to:

https://yourdomain.com/hub/login-form

This URL will dynamically load the component into the main content area of your site.

Other Common Examples #

Route Component Displayed
/hub/login-form <mediaos-login-form>
/hub/register-form <mediaos-register-form>
/hub/user-profile <mediaos-user-profile>
/hub/newsletter-manage <mediaos-newsletter-manage>
/hub/comment-feed <mediaos-comment-feed>

Tip: You can also pass query parameters to these URLs. For example:
https://yourdomain.com/hub/expo-directory?id=1

When to Use MediaOS Hub #

Use Hub-based routing when:

  • You want to avoid creating standalone pages for common MediaOS components.
  • You need to quickly deploy modals, forms, or tools without developer assistance.
  • You want to keep your templates clean and reusable.

Warning: Hub will only work if it is enabled via window.mediaos as shown above. If the page does not include mediaos_version: 2 and hub_enabled: true, routing will not function.

Skip to content