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:
Like so:
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: WealthAmpd | A Financial Independence Community, 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:
like so:
<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/
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