Answer the question
In order to leave comments, you need to log in
How to properly include @nuxtjs/amp module in a project?
Good evening! There was a need to create amp pages for a site on nuxt.js
Googled, found the module .
Connected in nuxt.config.js
// ...
modules: [
// ...
'@nuxtjs/amp'
],
amp: {
origin: process.env.BASE_URL,
css: '@/assets/styles/pages/amp-recipes.scss',
routeAliases: [
'/recipes'
]
},
// ...
<template>
<amp-body>
<h1>AMP</h1>
<Nuxt />
</amp-body>
</template>
recipes->index.vue
recipes->_slug.vue
recipes->index.vue
property ampLayout: 'amp'
recipes->_slug.vue
property We ampLayout: 'amp'
http://localhost:3000/amp/recipes/
http://localhost:3000/amp/recipes/какой-то слаг
v-if="$isAMP"
in the 1st template is not the best idea.
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question