Giter Club home page Giter Club logo

gridsome-starter-strapi's Introduction

gridsome-starter-strapi

This is a Gridsome Starter using the headless CMS Strapi. It is suppose to kick-start development with Strapi.

A Demo is hosted on Netlify.

Under the hood, the starter is using the source plugin @gridsome/source-strapi to pull data from Strapi into Gridsome's data store.

Images provided by Strapi are downloaded and saved locally via onCreateNode. Thus, the build version includes all images in /static.

Gridsome-Starter-Strapi Preview

Strapi Setup

Note: Steps that are marked with a check are already done and are just necessary if you set up a completely new project.

  1. ✅ Install the @gridsome/source-strapi Plugin: npm install @gridsome/source-strapi --save
  2. ✅ Add it to the config file:
export default {
  plugins: [
    {
      use: '@gridsome/source-strapi',
      options: {
        apiURL: 'http://localhost:1337',
        queryLimit: 1000, // Defaults to 100
        contentTypes: ['post'],
        // Possibility to login with a Strapi user,
        // when content types are not publicly available (optional).
        loginData: {
          identifier: '',
          password: ''
        }
      }
    }
  ]
}
  1. Install Strapi by following the Get Started Guide.
  2. Install Strapi and create a new project: npx create-strapi-app gridsome-starter-strapi-cms --quickstart.
  3. Complete the form to create the first Administrator user.
  4. Since we are using GraphQL, install the GraphQL plugin: npm run strapi install graphql. Open the GraphQL Playground (http://localhost:1337/graphql) to test your queries.
  5. Restart your server: npm run develop.
  6. In the Strapi Admin Interface you can now add Content Types (Plugins > Content-Types Builder > Create new collection type).
  7. Name you new collection type Post.
  8. Now, add 4 fields, namely title (text), subtitle (text), article (rich text) and image (single media).
  9. Click on Save.
  10. Add blog entries by clicking on Collection Types > Posts > Add New Post.
  11. Go to Plugins > Roles & Permissions. Click on the column saying Public. Put a check on find and findOne under Post. Click on Save.
  12. ✅ In gridsome.config.js add post under contentTypes.
  13. Finally, you should be able to query your blog entries with Gridsome.

Gridsome Setup

1. Install Gridsome CLI tool if you don't have

npm install --global @gridsome/cli

2. Create a Gridsome project

  1. gridsome create gridsome-starter-strapi to install default starter
  2. cd gridsome-starter-strapi to open the folder
  3. gridsome develop to start a local dev server at http://localhost:8080
  4. Happy coding 🎉🙌

💫 Deploy

Deploy to Netlify

gridsome-starter-strapi's People

Contributors

dependabot[bot] avatar lukaskoeller avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.