nuxt-themes/docus

Trailing slash flickering

GautierDele opened this issue · 6 comments

Hello,

I can see that all sites with docus have the same trailing slash flickering, just refresh all pages and you'll see the "/" appears for a second.

This is due to the host provider redirecting on directory: https://github.com/slorber/trailing-slash-guide

I took Nuxt Content documentation as an example: https://content.nuxtjs.org/guide/writing/mdc

I can see that still Nuxt Content is well referenced: https://www.google.com/search?q=site%3Acontent.nuxtjs.org%2F&rlz=1C1GCEA_enFR1026FR1026&oq=site%3A&gs_lcrp=EgZjaHJvbWUqBggAEEUYOzIGCAAQRRg7MgYIARBFGDsyBggCEEUYOTIGCAMQRRhAMgYIBBBFGDoyBggFEEUYQTIGCAYQRRhBMgYIBxBFGEHSAQgxMDc5ajBqN6gCALACAA&sourceid=chrome&ie=UTF-8

But on my side, Google Search is refusing my indexation due to "redirect errors", we might need to find a proper solution because I think it will become common.

My doc: https://laravel-rest-api.lomkit.com/

atinux commented

What do you mean Google Search is refusing to index?

Do you added your website to the search console, what does it tell you?

I'm getting an error due to redirects:
image

image
Google can't index this due to the problem.

For now I only have 1 page with this problem since I recently uploaded it but this might be common to all pages

atinux commented

So, I got the same error with Nuxt Image recently.

i does not mean the page is not indexed but actually 2 pages are seen and only one is indexed.

We have a pending PR (1 hour ago) to support the ability to render pages for SSG without trailing slash: unjs/nitro#1676

In the meantime, I added a canonical link in Nuxt Image and asked Google to re-index, see https://github.com/nuxt/image/blob/9f026b2edce881534c68cf8c9361a5ab2cb3fa33/docs/app.vue#L16

You can easily overwrite Docus app.vue by creating one in your project and copy/pasting the current one: https://github.com/nuxt-themes/docus/blob/main/app.vue

Thanks a lot @Atinux, i'll let this open until nitro's release if you don't mind

Full fix available with Nitro 2.6.3, update your nuxt.config.ts file:

  nitro: {
    prerender: {
      autoSubfolderIndex: false
    }
  }
atinux commented

Damn you are fast @GautierDele