Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

157
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda