Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

356
Views
Nuxt.js head() inside error layout not working when using in fetch() hook at SSR

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

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!