2

When we throw Nuxt error function in new fetch() hook with this.$nuxt.error() syntax, the title of error page which is not found is not applied in browser when using SSR (e.g: refreshing index page) and the title is empty (or its the same as defined in nuxt.config.js). But it works when on client side (e.g: switching between routes)

/layouts/error.vue

<template>
  <div>404 not found!</div>
</template>

<script>
export default {
  head() {
    return {
      title: "not found",
    };
  },
};
</script>

/pages/index.vue

<template>
  <div />
</template>

<script>
export default {
  fetch() {
    this.$nuxt.error({
      statusCode: 404,
      message: "Page not found",
    });
  },
};
</script>

Is it a bug or I miss something?

Codesandbox sample project link

Nuxt.js version: 2.15.8

1

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.