question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Markdown files not found in production

See original GitHub issue

@nuxt/content”: “^1.14.0”, “nuxt”: “^2.15.3”

I don’t want to bother you if I can but for whatever reason the articles are just not being generated in production. I have been following this article.

My folder structure: content/category/my-first-blog-post.md

My config: target: 'static',

// pages/en/_slug.vue

async asyncData({ $content, params, error }) {
    let article
    try {
      article = await $content('category', params.slug).fetch()
    } catch (err) {
      error({
        statusCode: 404,
        message: err
      })
    }
    return { article }
  }

On my local http://localhost:3000/en/my-first-blog-post it works fine, but in production after deploying to Netlify, Netlify will return 404. Making a get request to /_content does not work as well and will return 404. I have also ran nuxt generate and nuxt start to test out the site before deploying and it works perfectly.

I can’t figure out why its failing in Netlify, I’ve cleared cache and redeployed multiple times but the result is the same. It can only load the home page ‘/’ but not any other page. Link to the article on my site on Netlify.

Update: I’ve downloaded the dist/ directory generated by Netlify and compare it with my local dist/ and its pretty much the same. I’m starting to suspect its a Netlify thing?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
marscrusadercommented, May 28, 2021

I stand corrected and @ManasMadrecha is correct. For anyone else who visits this, you need to fetch the articles in an index page first before being able to navigate to the article.

0reactions
ManasMadrechacommented, Jun 13, 2021

@romain130492 We need to display the list of all posts somewhere in the whole website. It’s your choice where you display it, either in the /content folder’s md files or in the /pages folder’s vue files.

If you choose to write the links in md files, then they will be generated automatically because Nuxt can crawl it. But since you may not know which all links you have to type manually, it’s better to display the links in /pages vue file by fetching all the posts in it and displaying it in template.

But, if you do know that you only need to generate, say x no. of posts, then you can type them inside any md file, as long as that md file has also its link written somewhere in other md file or other vue file.

Read more comments on GitHub >

github_iconTop Results From Across the Web

knitr: object cannot be found when converting markdown file ...
what am I doing wrong? it just seems any data produced in each chunk is lost in memory when using knit! r ·...
Read more >
Markdown files cannot be found in netlify function environment
I am getting errors with my markdown blog. Pages and components seem to be working perfectly (tested with sample). but not working with...
Read more >
Can't create R Markdown files - RStudio Community
I'm using RStudio Version 1.3.1093 on a Mac running MacOS Big Sur 11.2. Can't create R Markdown files. On selecting 'File > New...
Read more >
4 R Markdown - Getting used to R, RStudio, and R Markdown
R Markdown provides an easy way to produce a rich, fully-documented reproducible analysis. It allows its user to share a single file that...
Read more >
Creating or opening a Markdown file (.md) raises an error
Steps to reproduce: 1. Open a Folder (not a Solution). 2. Create a Markdown file (for example, README.md). 3. An error is throw...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found