Giter VIP home page Giter VIP logo

gatsby-starter-hygraph-blog's Introduction

gatsby-starter-hygraph-blog

A Gatsby starter for creating a basic blog with Hygraph

Demogatsby-source-graphcms

Clone project Deploy with Vercel

Quick start

  1. Create a new Gatsby project via the Gatsby CLI
gatsby new hygraph-blog https://github.com/Hygraph/gatsby-starter-hygraph-blog
  1. Provide your Hygraph project keys

In order to use this starter, you'll need to have created a new Hygraph project using our Blog Template.

Navigate into your new site’s directory and copy the .env.sample file.

cd hygraph-blog
cp .env.sample .env

Inside of your newly created .env file, provide values for each variable. These variables can be found in the project settings UI.

HYGRAPH_ENDPOINT=""
HYGRAPH_TOKEN=""
  1. Start building!

Install the dependencies and start the gatsby dev server:

yarn
yarn dev

Features

gatsby-starter-hygraph-blog's People

Contributors

brob avatar jpedroschmitz avatar martian2lee avatar notrab avatar ozguruysal avatar renovate[bot] avatar ronakganatra avatar ynnoj avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gatsby-starter-hygraph-blog's Issues

Action Required: Fix Renovate Configuration

There is an error with this repository's Renovate configuration that needs to be fixed. As a precaution, Renovate will stop PRs until it is resolved.

Error type: Cannot find preset's package (github>whitesource/merge-confidence:beta)

Previous and next navigation for posts filtered by Category in Gatsby project not working

Somehow previous and next properties from context doesn't respect the filtered posts per Category?

I have a Category page template src/templates/CategoryPage.tsx where I have the following query to get the posts per category:

    type Props = {
      data: CategoryQueryQuery;
    };
    
    const CategoryPage = ({ data: { category } }: Props) => {
      const { categories } = useCategories();
      if (!category) return null;
      const categoryName = category?.name;
      const projects = category?.projects;
    
      return (
        <Layout>
          <h1>{categoryName}</h1>
          <CategoryList categories={categories} />
          <ProjectGrid projects={projects} />
        </Layout>
      );
    };
    
    export default CategoryPage;
    
    export const pageQuery = graphql`
      query CategoryQuery($slug: String!) {
        category: graphCmsCategory(slug: { eq: $slug }) {
          name
          slug
          projects {
            id: remoteId
            name
            slug
          }
        }
      }
    `;

From gatsby-node.js I pass previous and next thought the context:

    exports.createPages = async ({ graphql, actions: { createPage } }) => {
      const { data } = await graphql(`
        query Projects {
          projects: allGraphCmsProject(
            sort: { order: DESC, fields: createdAt }
            filter: { stage: { eq: PUBLISHED } }
          ) {
            edges {
              next {
                name
                slug
              }
              previous {
                name
                slug
              }
              node {
                slug
              }
            }
          }
          categories: allGraphCmsCategory {
            nodes {
              id: remoteId
              slug
            }
          }
        }
      `);
    
      const categories = data.categories.nodes;
    
      if (categories) {
        categories.forEach(({ id, slug }) =>
          createPage({
            path: `/projects/${slug}`,
            component: path.resolve('./src/templates/CategoryPage.tsx'),
            context: { id, slug },
          }),
        );
      }
    
      const projects = data.projects.edges;
    
      if (projects) {
        projects.forEach(({ node, previous, next }) => {
          createPage({
            path: `/projects/${node.slug}`,
            component: path.resolve('./src/templates/ProjectPage.tsx'),
            context: {
              slug: node.slug,
              previous,
              next,
            },
          });
        });
      }
    };

But now the previous and next properties doesn't respect the filtered posts array? So when there is only one post per category there should be no previous and next properties, but now they are..?

So the problem is that the previous and next properties from the pageContext counts all posts instead of the filtered posts array.

How do I solve this issue?

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Rate-Limited

These updates are currently rate-limited. Click on a checkbox below to force their creation now.

  • chore(deps): update dependency postcss-preset-env to v6.7.2
  • chore(deps): update dependency postcss-preset-env to v9
  • chore(deps): update dependency tailwindcss to v3
  • chore(deps): update mdx monorepo to v3 (major) (@mdx-js/mdx, @mdx-js/react)
  • chore(deps): update node.js to v20
  • 🔐 Create all rate-limited PRs at once 🔐

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

npm
package.json
  • @mdx-js/mdx 1.6.18
  • @mdx-js/react 1.6.18
  • classnames 2.2.6
  • gatsby 2.24.68
  • gatsby-image 2.4.21
  • gatsby-plugin-mdx 1.2.44
  • gatsby-plugin-postcss 2.3.13
  • gatsby-plugin-react-helmet 3.3.13
  • gatsby-plugin-react-svg 3.0.0
  • gatsby-plugin-sharp 2.6.39
  • gatsby-source-graphcms 2.0.0-next.11
  • gatsby-transformer-sharp 2.5.17
  • react 16.13.1
  • react-dom 16.13.1
  • react-helmet 6.1.0
  • react-transition-group 4.4.1
  • @tailwindcss/typography 0.2.0
  • @tailwindcss/ui 0.4.0
  • postcss-preset-env 6.7.0
  • tailwindcss 1.8.12
  • node ~16

  • Check this box to trigger a request for Renovate to run again on this repository

HyGraph CMS Docker Container

Hey everyone, does anyone know if there is a docker-compose manifest or image available for
Hygraph that I can use? Preferably a compose manifest I can spin up locally...

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.