From 79d2accf8ce00d2bebb38681f048c8519532d137 Mon Sep 17 00:00:00 2001 From: William Chong <6198816+williamchong@users.noreply.github.com> Date: Wed, 30 Oct 2024 02:53:03 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=8D=EF=B8=8F=20Add=20q=20&=20tag=20in?= =?UTF-8?q?=20store=20canonical=20URL=20(#1920)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 🔍️ Add q in store canonical url * 🐛 Fix i18n canonical url was not overwritten --- src/pages/store/articles.vue | 1 - src/pages/store/index.vue | 19 ++++++++++++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/pages/store/articles.vue b/src/pages/store/articles.vue index ebb7c1d8b..a7df3e792 100644 --- a/src/pages/store/articles.vue +++ b/src/pages/store/articles.vue @@ -161,7 +161,6 @@ export default { body: true, }, ], - link: [{ rel: 'canonical', href: `${this.$route.path}` }], }; }, computed: { diff --git a/src/pages/store/index.vue b/src/pages/store/index.vue index 493da34e3..86fcfcb07 100644 --- a/src/pages/store/index.vue +++ b/src/pages/store/index.vue @@ -516,7 +516,13 @@ export default { head() { const title = this.$t('store_index_page_title'); const description = this.$t('store_books_page_description'); - const link = [{ rel: 'canonical', href: `${this.$route.path}` }]; + const link = [ + { + hid: 'i18n-can', + rel: 'canonical', + href: this.canonicalLink, + }, + ]; const classIds = Array.from( new Set(this.bookstoreItems.map(b => b.classId).flat()) ); @@ -604,6 +610,17 @@ export default { 'getNFTClassMetadataById', ]), + canonicalLink() { + const baseUrl = `${EXTERNAL_HOST}${this.$route.path}`; + const { tag, q } = this.$route.query; + if (tag) { + return `${baseUrl}?tag=${tag}`; + } + if (q && this.sortedBookstoreItems.length) { + return `${baseUrl}?q=${q}`; + } + return baseUrl; + }, // Price filter related priceFilterList() { return [