Code Monkey home page Code Monkey logo

blog-website's Introduction

Keploy's blog with Next.js and WordPress

Configuration

Step 1. Prepare your WordPress site

First, you need a WordPress site. There are many solutions for WordPress hosting or you could use a Local by flywheel for setting up WordPress locally.

Once the site is ready, you'll need to install the WPGraphQL plugin. It will add GraphQL API to your WordPress site, which we'll use to query the posts. Follow these steps to install it:

  • Download the WPGraphQL repo as a ZIP archive.
  • Inside your WordPress admin, go to Plugins and then click Add New.
  • Click the Upload Plugin button at the top of the page and upload the WPGraphQL plugin.
  • Once the plugin has been added, activate it from either the Activate Plugin button displayed after uploading or from the Plugins page.

GraphQL

The WPGraphQL plugin also gives you access to a GraphQL IDE directly from your WordPress Admin, allowing you to inspect and play around with the GraphQL API.

Step 2. Populate Content

Inside your WordPress admin, go to Posts and start adding new posts:

  • We recommend creating at least 2 posts
  • Use dummy data for the content
  • Pick an author from your WordPress users
  • Add a Featured Image. You can download one from Unsplash
  • Fill the Excerpt field

When you’re done, make sure to Publish the posts.

Note: Only published posts and public fields will be rendered by the app

Step 3. Clone the repository

git clone https://github.com/keploy/blog-website.git
cd blog-website

Step 4. Install dependencies

npm install

# or

yarn install

Step 5. Set up environment variables

Copy the .env.local.example file in this directory to .env.local (which will be ignored by Git):

cp .env.local.example .env.local

Then open .env.local and set WORDPRESS_API_URL to be the URL to your GraphQL endpoint in WordPress. For example: https://Testapp.com/graphql.

Your .env.local file should look like this:

WORDPRESS_API_URL=...

Step 6. Run Next.js in development mode

npm run dev

# or

yarn dev

Your blog should be up and running on http://localhost:3000! If it doesn't work, post on GitHub discussions.

blog-website's People

Contributors

aniketbamotra avatar nehagup avatar aditya-eddy avatar sahadat-sk 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.