{
  "id": 11577564,
  "title": "Multilingual Ghost CMS Blog: 5. Making Home Links Language Aware",
  "url": "https://urgent.news/2026/10/03/multilingual-ghost-cms-blog-5-making-home-links-language-aware",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-10-03T02:02:55.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/sanghunkang/multilingual-ghost-cms-blog-5-making-home-links-language-aware-1di9"
  },
  "original_language": "en",
  "account": "This guide details how to configure the home navigation links on a multilingual Ghost CMS blog to point to the appropriate language-specific homepage. The home links can be found in the navigation bar, footer, and error page. These links are currently set to point to the main page of the default language, regardless of the multilingual settings. The objective is to modify them so they direct to the active language instead.\n\nThe default.hbs file already functions correctly when handling the block lang in an if condition. However, this method does not work properly on the error page or tag page as they do not include index-ko or index-en and do not explicitly assign lang values like post or page do. Instead of relying on lang, a new approach is adopted to retrieve the selectedLanguage value stored in localStorage and update the URL accordingly.\n\nTo implement this, separate functions are created and stored in a util.js file for reusability across multiple files. The getSelectedLanguage function retrieves the selectedLanguage value from localStorage, default to en if not found. The updateLink function updates the href of a specified selector based on the selected language. These functions are then loaded from the js/util.js file using the {{asset}} helper.\n\nThe error-404.hbs, error.hbs, and tag.hbs files are updated to incorporate the getSelectedLanguage and updateLink functions. In error.hbs, JavaScript is added to change the href of the .error-link based on the selected language. Similarly, in error.hbs and tag.hbs, JavaScript is added to change the href of .error-link and .site-nav-logo respectively based on the selected language.\n\nThe default.hbs file also includes a function that initializes the language selector. This function checks if the current URL includes /tag/ and sets the selected language accordingly in localStorage and the language selector. It then listens for a change event on the language selector and updates the href of .gh-head-logo, section.copyright a, and li.nav-home a based on the selected language.",
  "summary": "This explains how to make the home links in the navigation bar, footer, and error page point to the correct language-specific homepage. Home link in the navigation bar Home link in the footer Home link on the error page There are home links in the navigation bar, footer, and error page. These links are set to @site .url, and regardless of the multilingual settings, they only point to the main…",
  "key_points": [
    "Home navigation links updated to point to language-specific homepages.",
    "Functions getSelectedLanguage and updateLink created for URL updates.",
    "Error-404.hbs, error.hbs, and tag.hbs files modified for language-aware links."
  ],
  "editors_take": "Making home links language-aware changes how users navigate to the homepage in a multilingual Ghost CMS blog, now directing them to the active language-specific page instead of the default language.",
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}