DEV Community

Discussion on: Build a static generated blog with Nuxt v2.13.0 and @nuxt/content

Collapse
 
muhaddimu profile image
Muhaddis • Edited

Great post with a great explanation.

I am wondering why

<v-img src="Featured.png" alt="NPM Scripts"></v-img>

is not working inside the Markdown file. However, it's working in Vue component. I registered the component globally as well. Any ideas ?

Collapse
 
matthewblewitt profile image
Matthew Blewitt

Are you getting console errors? In that snippet of code I can see you haven't closed the closing tag and the src file name is capitalized.

Collapse
 
muhaddimu profile image
Muhaddis • Edited

I am not getting any errors in the console. Even though, I have tried to console.log(error)in the catch block.

For some reasons, the same code is working in the Vue slug.vue Component but not inside the Markdown files. Tried console logging the parameters before the return, it's showing the correct path but the image is not displaying.

Tried this approach, it's working fine:

 imgSrc() {
      try {
        return require(`~/content${this.src}`)
      } catch (error) {
        return null
      }
    }

See: github.com/MuhaddiMu/Portfolio/blo...

Now I have to pass the complete path relevant path /blog/slug-here/images/Featured.png

Fixed the typo in the comment. Is capital file name really matters?