Content: Using Variables that exist in the YAML or JSON files inside your markdown.

Created on 3 Jun 2020  路  1Comment  路  Source: nuxt/content

Is it possible to use the variables that comes from the YAML def or the JSON files or CSV files inside your markdown on a specific page.

In an index page I can go and fetch all the content of a specific folder inside the contents directory. I can list the content and then route to a specific page for e.g. markdown. But I want to use the same variables that was available when I received the content through this.$content inside the actual markdown page instead of manually typing it.

question

Most helpful comment

Hey @andyfensham,

When using nuxt-content component, all the document variables are injected inside the markdown, so you can do for example:

---
title: Introduction
src: https://content.nuxtjs.org/icon.png
---

<img :src="src"></img>

>All comments

Hey @andyfensham,

When using nuxt-content component, all the document variables are injected inside the markdown, so you can do for example:

---
title: Introduction
src: https://content.nuxtjs.org/icon.png
---

<img :src="src"></img>
Was this page helpful?
0 / 5 - 0 ratings