#Title change when I scroll

15 messages · Page 1 of 1 (latest)

midnight canopy
#

Hello,
I've got problem with title using useHead. When I scroll into my page, the title changing to a another title of page.

#

My app.vue :

<template>
  <div>
    <NuxtLayout>
      <NuxtPage />
    </NuxtLayout>
  </div>
</template>
<script setup>
useHead({
  titleTemplate: (title) => {
    return title ? `${title} — Compagny` : "Compagny";
  }
});
useSeoMeta({
  ogType: "website",
  twitterCard: "summary_large_image"
});
</script>
#

An example of page (each pages have useHead and useSeoMeta :

<script>
useSeoMeta({
  description: "Cool desc",
  canonical: "http://example.com",
});
useHead({
  title: "Secondary page",
  description: "Cool desc",
});
</script>
#

Under Nuxt 3.3.1 and without plugins.

I have this issue when nuxi dev AND nuxi generate :c

midnight canopy
#

Issue always here :c

dim wadi
#

Would it be possible to make a reproduction? The issue isn't very clear from what you've provided

midnight canopy
dim wadi
#

But what's the issue? It's still not clear

midnight canopy
dim wadi
#

This is very strange, haven't seen this before 🤔

#

I would say it's related to ssr: false

#

ah right

#

it's because useHead is a vue composable, it needs to run inside the setup() method

#

or you need to use <script setup>

midnight canopy