We will begin by refactoring the navigation and social media links:
- Create a navigation component in the /components/ directory, as follows:
// components/nav.vue
<template>
<li>
<nuxt-link :to="item.link" v-html="item.name">
</nuxt-link>
</li>
</template>
<script>
export default {
props: ['item']
}
</script>
- Create a social links component in the /components/ directory as well, as follows:
// components/social.vue
<template>
<li>
<a :href="item.link" target="_blank">
<i :class="item.classes"></i>
</a>
</li>
</template>
<script>
export default {
props: ['item']
}
</script>
- Import them into the <script> block in the layout, as follows:
// layouts/default.vue
import Nav from '~/components/nav.vue'
import Social from '~/components/social...