Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

156
Visualizações
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 Respostas
Responde à pergunta

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 Relatório

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda