ninest/nuxt-content-example

Issue on blog/posts links during navigation

alexandrecanijo opened this issue · 3 comments

Hi,

Found this issue within the blog page:
If you navigate to:
https://nuxt-content-example.surge.sh/posts/

Then click on the github link (on top menu), it will open the github page, on the same tab.
Try to press/click the browser back button, to go back the the blog/posts page.

And then hover the mouse on the links of the blog:
It will have a duplicated /posts/posts

Example:
https://nuxt-content-example.surge.sh/posts/posts/my-day

Expected scenario:

Url should work as in the first visit to the page and point to

https://nuxt-content-example.surge.sh/posts/my-day.

Hope this helps.

Thanks for informing me about this!

I just changed two things:

  1. In the PostContainer component, the it now takes you to /posts/${slug}

    Previous:

    <nuxt-link class="post-container" :to="`posts/${slug}`">

    Current:

    <nuxt-link class="post-container" :to="`/posts/${slug}`">

    I forgot to put the slash.

    Another issue was that if you visited nuxt-content-example.surge.sh/posts directly, the same problem you described exists

  2. The GitHub link in the navbar should open in a new tab should open in a new tab, so I added target="_blank.

Please try it out and see if everything works accordingly:

All good.

Hope this helped.

Cheers.

Thanks for creating the issue