Loading...
Loading...
Add and configure Contentful in an existing Next.js project. Covers installing the JavaScript SDK, configuring environment variables, creating production and preview-aware clients, fetching content in App Router or Pages Router, and wiring Draft Mode preview flows. Use when users ask to integrate Contentful with Next.js, fetch entries, set up preview or draft content, or configure the Contentful client. Also triggers on "Contentful SDK Next.js", "contentful.js", "fetch Contentful entries", "get content from Contentful", "Contentful preview", "preview mode", "Contentful environment variables", "Contentful client setup", "create Contentful client", "Pages Router Contentful", "getStaticProps Contentful", "Server Components Contentful", "revalidate Contentful", "ISR Contentful". Not for personalization or Experiences SDK setup (contentful-personalization). Not for non-Next.js frameworks (contentful-guide can route to platform docs).
npx skill4agent add contentful/skills contentful-nextjshttps://www.contentful.com/developers/docs/tools/mcp-server/echo "=== Contentful packages ===" && node -e "try{const p=require('./package.json');const d={...p.dependencies,...p.devDependencies};const c=Object.entries(d).filter(([k])=>k.includes('contentful'));console.log(c.length?c.map(([k,v])=>k+'@'+v).join('\n'):'(Contentful SDK not installed)')}catch{console.log('(no package.json)')}" 2>/dev/null
echo ""
echo "=== Contentful env vars ===" && grep -h CONTENTFUL .env.local .env 2>/dev/null | sed 's/=.*/=<set>/' || echo "(no Contentful env vars found in .env.local or .env)"
echo ""
echo "=== Router type ===" && ([ -d "app" ] && echo "App Router detected (app/ directory exists)" || ([ -d "pages" ] && echo "Pages Router detected (pages/ directory exists)" || echo "(could not detect router type)"))https://github.com/vercel/next.js/releases.env.localcontentfulhttps://github.com/vercel/next.js/releasesCONTENTFUL_SPACE_ID/spaces/<SPACE_ID>/...CONTENTFUL_ACCESS_TOKENCONTENTFUL_PREVIEW_ACCESS_TOKENCONTENTFUL_ACCESS_TOKENCONTENTFUL_PREVIEW_ACCESS_TOKENpreview.contentful.commasterenvironment