From 19c26e58c9f8483024a35a2be703ddd8526e1cd4 Mon Sep 17 00:00:00 2001 From: NGPixel Date: Thu, 8 Jan 2026 03:00:47 -0500 Subject: [PATCH] fix: handle breadcrumb locale prefix correctly --- .vscode/settings.json | 2 +- client/components/common/nav-header.vue | 6 +++++- client/themes/default/components/page.vue | 13 ++++++++++--- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index dc1a054c6..75e3a4478 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -8,7 +8,7 @@ "vue" ], "editor.codeActionsOnSave": { - "source.fixAll.eslint": true + "source.fixAll.eslint": "explicit" }, "i18n-ally.localesPaths": [ "server/locales" diff --git a/client/components/common/nav-header.vue b/client/components/common/nav-header.vue index ead24f945..e5f7acdfe 100644 --- a/client/components/common/nav-header.vue +++ b/client/components/common/nav-header.vue @@ -476,7 +476,11 @@ export default { window.location.assign('/logout') }, goHome () { - window.location.assign('/') + if (this.locales && this.locales.length > 0) { + window.location.assign(`/${this.locale}/home`) + } else { + window.location.assign('/') + } } } } diff --git a/client/themes/default/components/page.vue b/client/themes/default/components/page.vue index d3f089269..822e739fc 100644 --- a/client/themes/default/components/page.vue +++ b/client/themes/default/components/page.vue @@ -367,6 +367,8 @@ import _ from 'lodash' import ClipboardJS from 'clipboard' import Vue from 'vue' +/* global siteLangs */ + Vue.component('Tabset', Tabset) Prism.plugins.autoloader.languages_path = '/_assets/js/prism/' @@ -493,6 +495,7 @@ export default { }, data() { return { + locales: siteLangs, navShown: false, navExpanded: false, upBtnShown: false, @@ -537,10 +540,10 @@ export default { } }, breadcrumbs() { - return [{ path: `/${this.locale}`, name: 'Home' }].concat( + return [{ path: '/', name: 'Home' }].concat( _.reduce(this.path.split('/'), (result, value) => { result.push({ - path: _.get(_.last(result), 'path', `/${this.locale}`) + `/${value}`, + path: _.get(_.last(result), 'path', this.locales.length > 0 ? `/${this.locale}` : '') + `/${value}`, name: value }) return result @@ -650,7 +653,11 @@ export default { }, methods: { goHome () { - window.location.assign('/') + if (this.locales && this.locales.length > 0) { + window.location.assign(`/${this.locale}/home`) + } else { + window.location.assign('/') + } }, toggleNavigation () { this.navOpen = !this.navOpen