This is for adding links to your articles onto a page
This example will pull content from the content module (which tracks the files created by netlify cms), and render a series of links for all the articles.
You add this to the script tag in your vue file to access content from netlify cms
<script>
export default {
async asyncData({ $content }) {
const posts = await $content("blog").fetch();
return {
posts
};
},
}
</script>
- In this example, the
"blog"is referring to a collection title - Documentation on async/await functions
- This code snippit uses two different vue directives
<template>
<div>
<ul>
<li v-for="post in posts" :key="post.slug">
<NuxtLink v-bind:to="post.slug">{{ post.title }}</NuxtLink>
</li>
</ul>
</div>
</template>