Location hierarchy
City, region and country layers are always eligible when HI has hostels there.
One hosted HI search component for cities, regions and countries—with hostel-name matching and a mobile interface designed for the software keyboard.
The widget downloads HI’s public location index, searches it in the visitor’s browser and hands a chosen place to Hostel Explorer. Suggestions are cities, regions and countries; typing a hostel name can surface the places containing that hostel.
HI hosts the component and location data centrally. Member Associations do not need an API key, a software package or a locally hosted copy of the JavaScript.
On mobile, focusing the field opens a full-page search interface. Its results area scrolls independently and remains usable while the software keyboard is visible.
The old widget remains supported during migration. An MA can stage and approve the replacement normally, then roll back to its saved legacy embed if its own CMS or security policy causes a problem.
City, region and country layers are always eligible when HI has hostels there.
A focused interface with its own results scrolling above the keyboard.
Updates and current location data arrive without an MA reinstalling the widget.
Replace YOUR_MA_CODE with the MA’s code from the directory below. Keep the fallback link inside the component.
Look up the MA partner code below, then choose the language and tab behaviour.
Place the component in normal page flow and include the module script once.
Complete the staging checklist, publish, then repeat the mobile smoke test.
<hi-hostel-search
index-url="https://data.hihostels.com/v1/locations.json"
search-url="https://widgets.hihostels.com/go/hostels"
locale="en-GB"
partner="YOUR_MA_CODE"
target="_blank">
<a href="https://www.hihostels.com/discover/explore">Search HI hostels</a>
</hi-hostel-search>
<script type="module" src="https://widgets.hihostels.com/hostel-search/v1/hostel-search.js"></script>
If the widget appears more than once on a page, include the script only once. Do not download, proxy or self-host the component.
partnerThe non-personal attribution code supplied by HI from the canonical MA registry. Copy it exactly; do not invent a code from the MA name or website address.
localeUse en-GB for English or de-DE for German. Standard copy follows this setting.
targetUse _blank to open Explorer in a new tab, recommended for an external MA site, or _self for the same tab.
placeholder and button-label can override standard interface text by agreement with HI. Overrides are not automatically translated.
Add size="large" for a more prominent treatment. The host element also accepts --hi-widget-brand, --hi-widget-brand-hover, --hi-widget-accent, --hi-widget-surface, --hi-widget-field, --hi-widget-text, --hi-widget-radius and --hi-widget-max-width. Apply these properties directly to hi-hostel-search, not only to an ancestor: the component moves to the document layer while search is active. Keep colour contrast accessible and test the focused state on the final MA page.
If the widget's coloured container has no horizontal padding, use the supported maximum-width token to retain a 16 px gutter on each side. This keeps the standard 768 px desktop limit and avoids changing the widget's full-page mobile search interface.
hi-hostel-search {
--hi-widget-max-width: min(768px, calc(100% - 32px));
}
Use a more specific selector if the site contains other HI search widgets. Do not target internal Shadow DOM classes.
Search by Member Association name, country or code, then use the exact code shown in the widget’s partner attribute. Codes are non-personal and are used to attribute search journeys on the HI site.
Loading the current MA code directory…
No matching Member Association was found. Check the spelling. If the organisation is genuinely missing, contact HI so it can be added to the canonical registry.
This is the same hosted component and continuously refreshed location index an MA will embed. Try Paris, Sydney or the unaccented spelling Cordoba.
Paris and confirm city and country suggestions.Sydney and confirm Sydney, Australia is available as a city.Cordoba and confirm accented Córdoba results appear.source=ma-widget.The unchanged legacy widget is currently supported by HI’s compatibility service. MAs can schedule and test the replacement normally.
HI intends to maintain the legacy compatibility endpoints for at least 12 months after cutover and until measured use is negligible. HI will communicate before withdrawing support.
Keep a CMS revision or exact copy of the old embed.
Do not show both search interfaces in the same location.
Include a real phone with the keyboard open.
Check the public page in a private browser window.
Restore the saved legacy embed, publish it, then send HI the evidence below.
Add both HI service hosts to the relevant existing directives; do not replace the MA’s current sources or nonces.
script-src https://widgets.hihostels.com
style-src https://widgets.hihostels.com
connect-src https://data.hihostels.comThe browser must also be allowed to navigate to widgets.hihostels.com and www.hihostels.com. The widget does not require unsafe-eval or unsafe-inline.
Suggestions are filtered locally after the public index downloads. The submitted location, language, source=ma-widget and non-personal partner code appear in the destination query string.
The widget does not load HI PostHog or set HI analytics cookies on the MA website. After the visitor reaches the HI site, consented HI analytics can use the partner code to measure the search journey. A booking click is not a confirmed booking.
Do not put names, email addresses, customer IDs or other personal data in widget attributes.
The widget targets current evergreen desktop and mobile browsers, including current Safari on iOS and Chrome on Android. Each MA should still test its own supported matrix.
The fallback link remains available if JavaScript cannot run.
Place the component in normal flow in a container that can use the available width. Do not clip it or give its outer container a fixed height.
Shadow DOM isolates internal styling from the host site.
The standard component can run inside an accessible modal supplied by the MA. HI does not provide the launcher or surrounding dialog.
First compare the MA page with the hosted test above. If the hosted test works but the MA embed does not, include the MA page’s console or CSP error.
Embed file, installation guide, QA, rollback, technical notes and support template.
↘