Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

155
Views
How to fetch files from CDN with NuxtJS content module?

I want to fetch files from another server (e.g. a CDN) with the @nuxtjs/content module so that the .md files can be managed independently without Nuxt.js.

My current nuxt.config.js file looks like this:

export default {
  ...
  content: {
    dir: 'http://some-cdn.xyz/content/'
  },
  ...
}

Now I want to load the content in the pages/_slug.vue file:

<template>
  <div>
    <NuxtContent :document="doc" />
  </div>
</template>

<script>
  export default {
  async asyncData({ $content, params }) {
    const doc = await $content(params.slug || 'index').fetch();
    return { doc };
  },
};
</script>

Now when I type in http://localhost:3000/some-page, I should get the corresponding file (some-page.md) from the CDN. Instead, I get this error from Nuxt.js: /some-page not found.

What should I do to get it working and is this even possible with my current setup?

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

As told here: https://github.com/nuxt/content/issues/237

This is not doable with the content module and is not planned to be done neither. A solution would be to manually fetch the files during the build time or alike.

You can maybe get some inspiration from this comment: https://github.com/nuxt/content/issues/37#issuecomment-664331854 or use another markdown parser.

about 4 years ago · Juan Pablo Isaza Report

0

Since @nuxtjs/content can't fetch files from another server, I used the marked.js library instead.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!