2
votes

I have a Nuxt project and for the SEO purpose, I need to reload the pages every time I do visit any page. Is there any way I can do it on Routers?

Currently, my app is with the default behavior of NUXT " renders only the required components on visit". But I need to completely reload the pages.

2
Doesn't make any sense. For seo it will follow link in HTML and it will be server rendered each time. What you trying to do is to spoil use experience - Aldarund
What is that "SEO purpose"? - emirowski
Reference DOC - Empty Brain

2 Answers

4
votes

I do believe that reloading the page cleares (and re-initializes) your vuex store, if you are using that

I don't know how to reload the page but I have a few suggestions that you could test

Suggestion 1 Wrap your page with a v-if. Then it wont render until you visit it

<template>
  <app v-if="someBoolean">
     .
     .
  </app>
</template>
<scripts>
  export default {
    computed: {
      someBoolean () {
        return blabla 
      }
    }
  }
</scripts>

Suggestion 2

this.$forceUpdate();

Suggestion 3 Bind your component to a key

<template>
  <yourComponent :key="componentKey" />
</template>

And change that key whenever you need re-rendering

1
votes

If you want to refresh the page manually you can call - this.$router.app.refresh()