Skip to content

amazing Responsive Blog Application consisting featured and recent posts, categories, full markdown articles, author information, comments and much more, managed by @hygraph dedicated CMS built with NextJS based on @graphql 馃搼

License

Notifications You must be signed in to change notification settings

ladunjexa/nextjs13-blog

Repository files navigation

Project Banner Project Banner

Nextblog

Nextblog is the best GraphQL Blog Application with everything you can imagine - built with NextJS

contributors last update forks stars open issues license


馃摂 Table of Contents

馃専 About the Project


Nextblog is an outstanding Blog Application with featured and recent posts, categories, full markdown articles, author information, comments, and much more, works with Hygraph. hygraph is a headless content management system based on GraphQL technology enabling seamless integration with any application.

鈥硷笍 Folder Structure

Nextblog code folder structure

Nextblog/
|- components/
|- pages/
  |-- api/
  |-- category/
  |-- post/
|- sections/
|- services/
|- styles/

Now, lets dive into the main folder

components

Author.jsx - Categories.jsx - Comments.jsx - CommentsForm.jsx - FeaturedPostCard.jsx - Header.jsx - Layout.jsx - Loader.jsx - PostCard.jsx - PostDetail.jsx - PostWidget - index.js

This folder contains all React Components, which they're independent and reusable bits of code. They serve the UI (User Interface) of Nextblog to avoid unnecessary repetition of the code. those components are beautiful customized widgets using TailwindCSS to describe theme for widgets as they're named.

pages

_app.js - index.js - category - post - api

this folder contains activities / scenes of application as a exported react arrow function components. this folder contains a well-structured activities / scenes of applications using NextJS Best Practices. Nextblog includes Home page, Dynamic Categories & Blogposts pages.

sections

FeaturedPosts.jsx file implement the featured posts sections using React-Multi-Carousel

services

index.js - This script exports multiple GraphQL queries for a blog website. The queries retrieve information about posts, post details, recent posts, similar posts, featured posts, adjacent posts, posts belonging to a specific category, and categories. The queries use the GraphQL request library to send the queries to the Hygraph endpoint specified in the graphqlAPI environment variable.

For example, Here is getPostDetails function

export const getSimilarPosts = async (categories, slug) => {
  const query = gql`
    query GetPostDetails($slug: String!, $categories: [String!]) {
      posts(
        where: {
          slug_not: $slug
          AND: { categories_some: { slug_in: $categories } }
        }
        last: 3
      ) {
        title
        featuredImage {
          url
        }
        createdAt
        slug
      }
    }
  `;

  const result = await request(graphqlAPI, query, { categories, slug });

  return result.posts;
};

styles

global.scss file is the stylesheet file written in SCSS and uses the Tailwind CSS framework. It defines the default styles and custom styles for the HTML elements and components used in a web page.

(back to top)

馃攽 Environment Variables

In order to use Nextblog you have to add the following environment variable to your .env file

NEXT_PUBLIC_GRAPHCMS_ENDPOINT=<HYGRAPH_ENDPOINT>
GRAPHCMS_TOKEN=<HYGRAPH_TOKEN>

馃懢 Tech Stack

React Next JS SASS TailwindCSS GraphQL

(back to top)

馃О Getting Started

鈿欙笍 Installation

Step 1:

Download or clone this repo by using the link below:

 https://github.com/ladunjexa/GraphQL-Nextblog

Step 2:

Nextblog using NPM (Node Package Manager) Yarn, therefore, make sure that Node.js is installed by execute the following command in consle

  node -v

Step 3:

Go to root folder and execute the following command to get the required packages:

  npm install

Step 4:

At the root folder execute the following command in order to run the development sever:

  npm run dev
  #or
  yarn dev

(back to top)

馃憢 Contributing

Contributions are always welcome!

See contributing.md for ways to get started.

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

(back to top)

鈿狅笍 License

Distributed under the MIT License. See LICENSE.txt for more information.

(back to top)

馃 Contact

Liron Abutbul - @lironabutbul6 - @ladunjexa

Project Link: https://github.com/ladunjexa/GraphQL-Nextblog

(back to top)

馃拵 Acknowledgements

This section used to mention useful resources and libraries (packages) that used in Nextblog application project.

(back to top)

About

amazing Responsive Blog Application consisting featured and recent posts, categories, full markdown articles, author information, comments and much more, managed by @hygraph dedicated CMS built with NextJS based on @graphql 馃搼

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published