Template Changes for Subdirectory Setup
Update your Helpjuice templates to support subdirectory-based URLs.
Table of Contents
Update Internal Links Adjust Form Actions Meta Tags and Canonical URLs Review Custom Scripts Language Switcher Paths Need Help?When setting up your Helpjuice Knowledge Base to run on a subdirectory (such as /help
), some updates are required within your templates to ensure paths and functionality remain intact. This guide outlines the key template changes you may need to make after switching to a subdirectory structure.
Each of the sections below covers a common area where updates may be needed, such as internal links, forms, meta tags, and JavaScript. You don’t need to apply every change listed here - it depends on how your templates were originally built.
It’s important to understand how paths behave differently when your Knowledge Base is no longer at the root of your domain. Adjustments made in the right places will help maintain navigation, indexing, and any logic relying on specific URLs.
Update Internal Links
Links to categories, articles, or search pages that previously used relative or root-level paths should now include the subdirectory. For example:
<a href="/{{ category.url }}">
should become:
<a href="/help/{{ category.url }}">
Review your navigation menus, footers, buttons, and anywhere internal links are manually defined.
Adjust Form Actions
Forms such as search or contact forms often include an action
attribute pointing to a root-relative path. Update these to reflect the subdirectory structure. For instance:
<form action="/search">
should become:
<form action="/help/search">
Ensure the action path matches your new structure to avoid submission issues.
Meta Tags and Canonical URLs
If your template includes custom meta tags such as knowledge-base-url
or canonical URLs, these should also reflect the subdirectory. These tags should be placed inside the <head>
tag within your Main Layout template.
<meta name="knowledge-base-url" content="https://yourdomain.com/help">
Keeping these values up-to-date helps ensure your site is indexed properly and that any scripts depending on full URLs behave as intended.
Review Custom Scripts
Any JavaScript logic that references paths or handles redirects should be reviewed. Look for scripts that use window.location.pathname
or hardcoded paths (e.g., /categories
) and prepend the subdirectory where needed.
For example:
if (window.location.pathname === "/search") {
window.location.href = "/help/search";
}
This ensures custom logic continues to work properly after the move to a subdirectory.
Language Switcher Paths
If your site supports multiple languages and uses a language switcher, ensure each language’s base path includes the subdirectory.
You may need to adjust logic that builds these URLs dynamically, making sure /help
is part of the final path regardless of selected language.
Need Help?
If you're not sure where to apply these changes — or you'd prefer our team to handle the updates for you — we're here to help. You can submit a customization request and include details about your current setup and the subdirectory you're using.
We'll review your templates and implement the required updates to ensure everything works smoothly with your new structure.