Get Started
Installation
Learn how to install and configure the Nuxt Craft CMS module.
Requirements
- The Craft Query API plugin must be installed and configured.
- Nuxt 3 is required.
Install
You can add the Nuxt module at anytime during your Nuxt project development by installing the nuxt-craftcms
module.
npx nuxi module add nuxt-craftcms
You can configure Nuxt Craft CMS module with the craftcms
property in your nuxt.config file.
nuxt.config.ts
import { defineNuxtConfig } from 'nuxt';
export default defineNuxtConfig({
modules: ['nuxt-craftcms'],
craftcms: {
// My custom configuration
}
});
Configuration
You can now start to configure the craftcms
property.
nuxt.config.ts
export default defineNuxtConfig({
craftcms: {
baseUrl: '', // Required
debug: false,
registerComponents: true,
enableEntryTypeMapping: true,
}
});
- baseUrl: refers to the PRIMARY_SITE_URL of Craft CMS, without a trailing slash.
- debug: enables debug mode and log built urls
- registerComponents: Globally register all components
- enableEntryTypeMapping: This allows the
CraftPage
component to automatically detect your entries based on their section handle and entry type.
Development with DDEV
DDEV utilizes a self-signed SSL certificate. To ensure Node can connect without issues, you’ll need to allow it to bypass SSL verification by setting the following environment variable:
.env
NODE_TLS_REJECT_UNAUTHORIZED=0
Boom, finished. 🚀