↑↓ selectEnter openEsc close

    1. Elbuz

    How to set up product links and language prefixes in smart search

    4 min readUpdated

    Elbuz smart search builds the product link itself from the site address, the language prefix and the product's SEO address, so a shopper from the Ukrainian or Russian search window lands on the product page in their language.

    When you need this:

    • The main language has no prefix, the second uses /ru/ — the {site_url}/{language_code}/{url} template gets both right.
    • Products came from another site or marketplace — the link is taken from the link to that source.
    • Photos in the search window don't open — the photo template inserts the image path.

    Where to start: the “Links” tab → the “Product URL template” field → paste the template.

    What you can set on the “Links” tab

    The “Link templates” card: the product URL template with a language prefix and the macros explained
    1Category
    2Product
    3Macros explained
    4External source
    5Image
    1. Takes effect after the index update.
    2. The field holds a tested template with a language prefix; an empty template gives an address without a prefix.
    3. The language macro is the SEO prefix from “Directories → Languages”, not the language code.
    4. A product address on another site or marketplace; takes effect after the index update.
    5. The image macro is the photo path in the catalog; takes effect after the index update.

    How to build the product link

    Search builds the product link every time it shows a product to a shopper, using the “Product URL template” field. A template is an address in which the parts that differ for each product are written as macros in curly braces.

    Product URL template macros
    MacroWhat is insertedExample
    {site_url}the “Site address” from the “Setup” tab. If it's written without https://, search adds it itselfhttps://myshop.com
    {language_code}the SEO prefix of the language the shopper uses on the site — from Directories → Languages. This isn't the language code: the main language usually has an empty prefixru or nothing
    {url}the product's SEO address from its card in the catalogsmartfon-galaxy-a57
    {external_url}the product link from another site or marketplace — see belowhttps://…

    Search removes double slashes that appear when a macro is empty: https://myshop.com//smartfon becomes https://myshop.com/smartfon. That's why the {site_url}/{language_code}/{url} template is safe for a language without a prefix too.

    • Empty template — the link is made of the “Site address” and the product's SEO address, without a language prefix. That's enough for a single-language site; on a multilingual one, all languages will lead to the main language's pages.
    • Fixed text in the template stays as is: {url}.html gives https://myshop.com/smartfon-galaxy-a57.html. Search adds the “Site address” to a template without {site_url} by itself.
    • Template changed — shoppers see the new links from the next search, without rebuilding the index. The exception is switching to {external_url} or back: then rebuild the index.
    • A product's SEO address is the same for all languages: links in different languages differ only by the prefix.

    How language prefixes work

    The {language_code} macro takes the prefix not from the page address but from the Elbuz language settings: for each enabled language, search knows its SEO prefix (the “Language prefix in SEO URLs” column). The language is determined by the language in which the shopper opened the search window.

    An example of a site where Ukrainian is the main language without a prefix and Russian uses /ru/:

    Shopper's languagePrefix in Directories → LanguagesLink by the {site_url}/{language_code}/{url} template
    Ukrainianemptyhttps://myshop.com/smartfon-galaxy-a57
    Russianruhttps://myshop.com/ru/smartfon-galaxy-a57

    The prefix is taken from Directories → Languages automatically. It must match what your site's addresses use. If the site shows Russian at /ru/ but the Russian prefix in Elbuz is empty, links from the Russian search window will lead to Ukrainian pages.

    Links from another site or marketplace

    When products were imported from a third-party source and Elbuz stores each product's address there, search can lead exactly to it. To do this, fill in both fields in the “Link to a product from an external source” block, and keep {external_url} in the product template.

    • “Source code (source_code)” — the code of the link type, for example etrade_tunnel for exporting to the site.
    • “Source template ID (source_id)” — the number of this source's template. Without the number, the code field has no effect.

    What happens after that:

    • product addresses and IDs from the source get into search during the index update — nothing changes until the rebuild;
    • the product ID on the site is taken from the same link — the cart buttons receive it, see how to connect the cart;
    • a product with no link to this source leads to its own page on your site — by the SEO address from the catalog.

    Links to categories and photos

    Both templates are applied when the search index is built, not during search. If you changed them, click “Create search index” on the “Setup” tab: until then search shows the old addresses.

    Category URL template

    Category fields are written in curly braces, for example {url}.html, where {url} is the category's SEO address. With an empty template, the SEO address is used as is. This address goes with the category in the search data, including through the API. A click on a found category in the shopper's search window doesn't go anywhere: it narrows the results to that category.

    Product image URL template

    The {image} macro is the path to the photo in the Elbuz catalog. The https://myshop.com/image/{image} template turns each product photo into an address on your site, all photos in the same order as on the card. With an empty template, search takes photos from the Elbuz cloud or from the original link the photo was downloaded from.

    Search, cart and list pages

    The “Store pages” card holds the full addresses of your site's pages. The buttons that lead to them appear in the search window below a non-empty list, and only when the address is filled in.

    FieldWhat it does
    Search URL templateyour site's results page. The word {query} is replaced with the shopper's query; if it's missing, the query is appended to the end: https://myshop.com/search/?search=. Works when “Press Enter to open the search page” is turned on in the “View” tab
    Cart linka button to go to the site cart below the cart list in the search window
    Checkout linka second button next to the cart; not shown without the cart link
    Link to the product comparison lista button to go there below the comparison list
    Link to the product wishlista button to go there below the wishlist
    Link to promotionsyour site's promotions page: the “Promotions” chip in the window with no query, the “View promotions” button when nothing is found, and a link at the bottom of the search window

    These buttons open the page in a new tab. The language prefix isn't inserted into these addresses — the link is the same for all languages.

    Choosing “CMS ID” on the “Setup” tab fills these fields with your CMS's typical addresses if the “Site address” is already set, and asks before replacing your addresses. It doesn't touch the search field.

    The “Store pages” card: the addresses of the search page, cart, checkout, comparison and wishlist
    1Search page
    2Checkout
    3Cart
    4Comparison and wishlist
    1. The query macro is replaced by the shopper's words; works with “Press Enter to open the search page”.
    2. A second button next to the cart, only if the cart link is filled in.
    3. A button to the site cart under the cart list in the search window.
    4. Buttons under the comparison and wishlist lists.

    Scenarios

    Ukrainian without a prefix, Russian with /ru/

    What to do. In Directories → Languages, check the prefixes: empty for Ukrainian, ru for Russian. In the smart search form, on the “Links” tab, enter the product template {site_url}/{language_code}/{url}.

    What you get. From the Ukrainian search window the shopper goes to https://myshop.com/product, from the Russian one — to https://myshop.com/ru/product. You don't need to rebuild the index.

    You added English to the site

    What to do. Enable English in Elbuz and give it the en prefix in Directories → Languages. Rebuild the index so that English names get into search.

    What you get. The English search window leads to /en/ pages.

    Products are exported to the site, but the site addresses differ from the catalog

    What to do. In the external source block, enter the code etrade_tunnel and the export template number, and set the product template to {external_url}. Rebuild the index.

    What you get. Search leads to the addresses saved by the link with the site, and the cart buttons receive the product ID on the site.

    What to do when a link leads to the wrong place

    What you seeWhyWhat to do
    Russian search opens a Ukrainian pagethe template is empty or lacks {language_code}, or the Russian language has an empty prefixthe {site_url}/{language_code}/{url} template, the prefix in Directories → Languages
    The link has no domain or points to someone else's domainthe “Site address” on the “Setup” tab is empty or has an errorenter the site address, for example https://myshop.com
    You changed the category or photo template, but nothing changedthese templates take effect only after the index rebuildclick “Create search index”
    Enter in the search box doesn't open the results pagethe “Search URL template” is empty or “Press Enter…” is offfill in the link and turn on the checkbox on the “View” tab

    FAQ

    Is the language macro in the template ua or uk?

    Neither. It inserts the language's SEO prefix from Directories → Languages — what your site's addresses use. An empty prefix gives an address without a language part. Details: how language prefixes work.

    Can I add .html after the product address?

    Yes: the {site_url}/{language_code}/{url}.html template. Search keeps fixed text as is, and you don't need to rebuild the index.

    Can I send all shoppers to one language, whatever language they search in?

    Yes: remove {language_code} from the template or leave the template empty. Then links from all languages lead to pages without a prefix.

    A shopper clicks a category in the search window but doesn't go to the category page. Is this a bug?

    No. A click on a category narrows the search results to it, and the shopper stays in the search window. The category address is needed in the search data and the API.

    Where it is and who has access

    Menu
    Directories → Categories → the “Widget settings - Smart search” tile → the “Links” tab
    Other entry points
    language prefixes — Directories → Languages
    Access right
    the “Smart product search widget” window in “Group permissions”
    Prepare
    the site address on the “Setup” tab, language prefixes as on the site

    Related topics

    Was this article helpful?

    Missing a feature? Tell us.

    We will add it for free if other users need it too.

    If only you need it, we will agree on it separately.

    Article contents

    Suggest an improvement

    Try Elbuz free