如何使用NUXT和VUE I18N在SSR期间修改替代链接

发布于 2025-02-09 15:49:18 字数 163 浏览 1 评论 0原文

我想修改特定页面的HREF属性(删除查询字符串) 如下所示:

“

或可能完全删除特定页面的链接元素,

我该如何存档?

I want to modify the href attribute(to remove query string) for specific pages
like screenshot below:

screenshot

or maybe entirely remove the link element for specific pages

How can I archive that?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

红玫瑰 2025-02-16 15:49:19

使用NUXT,您只需要指定定义以下链接的head函数:

export default {
  head() {
    return {
      link: [
        { rel: 'alternate', hreflang: 'zh', href: 'http://my-main-alternate-link' },
        { rel: 'alternate', hreflang: 'en', href: 'http://my-english-alternate-link' }
      ]
    }
  }
}

恐怕我要手动指定所有语言的所有链接。

With nuxt, you just have to specify a head function that defines these links:

export default {
  head() {
    return {
      link: [
        { rel: 'alternate', hreflang: 'zh', href: 'http://my-main-alternate-link' },
        { rel: 'alternate', hreflang: 'en', href: 'http://my-english-alternate-link' }
      ]
    }
  }
}

You'll have to manually specify all the links for all languages I'm afraid.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文