# Intermittent issue with dynamic routes using Nuxt and NetlifyCMS

**URL:** <https://answers.netlify.com/t/intermittent-issue-with-dynamic-routes-using-nuxt-and-netlifycms/33012>\
**Category:** Support\
**Tags:** vuejs, netlify-newbie, deployment\
**Created:** [February 22, 2021, 10:11pm UTC](https://answers.netlify.com/t/intermittent-issue-with-dynamic-routes-using-nuxt-and-netlifycms/33012 "2021-02-22T22:11:00Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![HarryHiggins](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/harryhiggins/32/22433_2.png) [@HarryHiggins](https://answers.netlify.com/u/HarryHiggins)\
**Post date:** [February 22, 2021, 10:11pm UTC](https://answers.netlify.com/t/intermittent-issue-with-dynamic-routes-using-nuxt-and-netlifycms/33012/1 "2021-02-22T22:11:00Z")

</div>

Hey everyone 👋

I’m new here so sorry if this ends up being a rambling, stupid question! I’m not even sure if it’s a netlify issue.

## The background

I’m using NetlifyCMS to power a blog on my site, built using Nuxt.

As per the Nuxt docs, I’m defining the routes in the nuxt.config.js:

> **[The generate Property](https://v2.nuxt.com/docs/configuration-glossary/configuration-generate/)**
>
> Configure the generation of your universal web application to a static web application.

Like so:

```auto
generate: {     
    async routes () {
      const { $content } = require('@nuxt/content')
      const files = await $content('blog').only('slug').fetch();
      return files.map(file => `/${file.slug}`);
    }
  }

```

when I run npm run generate (which is the build command I’ve configured netlify to use) locally the routes are simply: `/post-slug-here`.

In netlify’s deploy details in the “new pages include” list I get: `what-is-financial-literacy/index.html` which is correct - the slug of one of my blog posts made using NetlifyCMS.

## The issue

When I go to my live, deployed site: [https://www.wealthampd.com/blog/](https://www.wealthampd.com/blog/), the posts listed are linking to `/blog/post-slug-here` as opposed to just `/post-slug-here` so they’re 404ing.

For transparency I’m using the NuxtLink component on the blog index page:

> **[Built-in Components](https://v2.nuxt.com/docs/features/nuxt-components/)**
>
> Nuxt comes with a few important components included out of the box, which will be helpful when building your application.

like so:

```auto
   <NuxtLink :to="post.slug">Read more</NuxtLink>

```

What is really odd though, is if you go to an individual post e.g.

[https://www.wealthampd.com/what-is-financial-literacy/](https://www.wealthampd.com/what-is-financial-literacy/)

and then go back to the blog index page, the links will be pointing to the correct place…

👻 Spooky, right?

## The end

Sorry that this is so rambly, but I’m completely lost as to what is going on here. I might be completely missing the point and I’m not 100% sure this is a netlify problem or a nuxt problem or a me problem. Thanks for reading 🙂

---

<div class="post-metadata">

**Author:** ![HarryHiggins](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/harryhiggins/32/22433_2.png) [@HarryHiggins](https://answers.netlify.com/u/HarryHiggins)\
**Post date:** [February 22, 2021, 10:11pm UTC](https://answers.netlify.com/t/intermittent-issue-with-dynamic-routes-using-nuxt-and-netlifycms/33012/2 "2021-02-22T22:11:42Z")

</div>

Just thought - wonder if I could set up a redirect from /blog/slug to /slug as a workaround?

---

<div class="post-metadata">

**Author:** ![HarryHiggins](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/harryhiggins/32/22433_2.png) [@HarryHiggins](https://answers.netlify.com/u/HarryHiggins)\
**Post date:** [February 23, 2021, 10:40am UTC](https://answers.netlify.com/t/intermittent-issue-with-dynamic-routes-using-nuxt-and-netlifycms/33012/3 "2021-02-23T10:40:26Z")

</div>

I’ve added a redirect:

`/blog/* /:splat 301`

but it’s now redirecting `/blog` to `/` 😧

---

<div class="post-metadata">

**Author:** ![HarryHiggins](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/harryhiggins/32/22433_2.png) [@HarryHiggins](https://answers.netlify.com/u/HarryHiggins)\
**Post date:** [February 23, 2021, 12:11pm UTC](https://answers.netlify.com/t/intermittent-issue-with-dynamic-routes-using-nuxt-and-netlifycms/33012/4 "2021-02-23T12:11:15Z")

</div>

When going directly to

[www.wealthampd.com/blog](http://www.wealthampd.com/blog)

the redirect kicks in to the homepage ([www.wealthampd.com](http://www.wealthampd.com))

if you use the menu (top right) to go to the blog, the redirect doesn’t do anything (which is intended)

I’m sure this will be some sort of config issue that I’ve failed to set up but unsure what it could be.

> [@\[Support Guide\] Making redirects work for you - troubleshooting and debugging](https://answers.netlify.com/t/support-guide-making-redirects-work-for-you-troubleshooting-and-debugging/13433):
>
> Last reviewed by Netlify Support in July 2025 Introduction You’ve put blood, sweat and tears into building an incredible static site with all the bells and whistles. However, you’ve configured some redirect rules and you’ve come unstuck… they don’t appear to be working! Ensure you’ve followed the correct guidance Our [redirects and rewrites document](https://docs.netlify.com/routing/redirects/) covers a broad range of use cases, from [status codes](https://docs.netlify.com/routing/redirects/redirect-options/#http-status-codes) to [proxying another service](https://docs.netlify.com/routing/redirects/rewrites-proxies/#proxy-to-another-service) and everything in between. Ensure you’re using the correct syntax …

I’ve checked the redirect guide and have downloaded a .zip of my latest deploy to check the \_redirects file but it all looks sensible to me.

---

<div class="post-metadata">

**Author:** ![Scott](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/scott/32/26136_2.png) [@Scott](https://answers.netlify.com/u/Scott)\
**Post date:** [February 23, 2021, 3:00pm UTC](https://answers.netlify.com/t/intermittent-issue-with-dynamic-routes-using-nuxt-and-netlifycms/33012/5 "2021-02-23T15:00:54Z")

</div>

> [@HarryHiggins](#):
>
> /blog/\* /:splat 301

This rule will also catch `/blog/`, which is the main `blog` page.

You can add a redirect rule above this: `/blog /blog 200!` as redirects are read chronologically.

Otherwise, I think you’ll want to check out the Nuxt configuration as to why they’re sitting under `/blog` in the first instance. It may be related to [this setting](https://nuxtjs.org/docs/2.x/configuration-glossary/configuration-router#base) but, alas, my knowledge of Nuxt is limited!

---

<div class="post-metadata">

**Author:** ![HarryHiggins](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/harryhiggins/32/22433_2.png) [@HarryHiggins](https://answers.netlify.com/u/HarryHiggins)\
**Post date:** [February 23, 2021, 3:27pm UTC](https://answers.netlify.com/t/intermittent-issue-with-dynamic-routes-using-nuxt-and-netlifycms/33012/6 "2021-02-23T15:27:10Z")

</div>

Thank you so much @Scott! 🥧 I’ve just updated my \_redirects file and have tested it live and it looks like we’re all good now.

Ah that’s such a relief, thank you again. 😊
