From 5be6be0e45fa45ec0d5a0e16075c7f4dc02ff298 Mon Sep 17 00:00:00 2001 From: Jerel Miller Date: Mon, 22 Jun 2020 16:36:04 -0700 Subject: [PATCH] feat: Add query to homepage to look for guides that are promoted to homepage --- src/pages/index.js | 177 +++++++++++++++++++++++++++------------------ 1 file changed, 107 insertions(+), 70 deletions(-) diff --git a/src/pages/index.js b/src/pages/index.js index a3684fc32..3fd16dca2 100644 --- a/src/pages/index.js +++ b/src/pages/index.js @@ -1,5 +1,7 @@ import React from 'react'; +import PropTypes from 'prop-types'; import cx from 'classnames'; +import { graphql } from 'gatsby'; import Layout from '../components/Layout'; import SEO from '../components/Seo'; @@ -80,87 +82,122 @@ const guides = [ }, ]; -const IndexPage = ({ pageContext }) => ( - - - - Observability for every developer +const IndexPage = ({ data, pageContext }) => { + const { + allMdx: { nodes }, + } = data; -
-
-

- Welcome to the New Relic developer site! Here, you’ll find the tools - and resources you need to build on and customize the platform. -

-

- You need custom data that improves performance. We have tools for - that! Learn how to collect data from any source and visualize it the - way you need. Build out solutions in your own custom apps, and then - automate them. From how-to guides to video tutorials, community - projects, and more - we’ve got you covered. -

-

- Best of all? This open source site is built for you — your - suggestions, feedback, and comments are just a Pull Request away. -

-
-
+ return ( + + + + Observability for every developer + +
+
+

+ Welcome to the New Relic developer site! Here, you’ll find the + tools and resources you need to build on and customize the + platform. +

+

+ You need custom data that improves performance. We have tools for + that! Learn how to collect data from any source and visualize it + the way you need. Build out solutions in your own custom apps, and + then automate them. From how-to guides to video tutorials, + community projects, and more - we’ve got you covered. +

+

+ Best of all? This open source site is built for you — your + suggestions, feedback, and comments are just a Pull Request away. +

+
+
+ +
+ +
+ + Get started + + + + +
+ + {getStartedGuides.map((guide, index) => ( + + ))} + +
+
-
-
- - Get started - - - - -
+ + Extend the platform + - {getStartedGuides.map((guide, index) => ( - + {nodes.map(({ frontmatter }, index) => ( + ))}
-
- - - - Extend the platform - - - {guides.map((guide, index) => ( - - ))} - - -

- Looking for inspiration? Check out the{' '} - - open source projects - - {' '} - built by the New Relic community. -

-
-
-); +

+ Looking for inspiration? Check out the{' '} + + open source projects + + {' '} + built by the New Relic community. +

+
+
+ ); +}; IndexPage.propTypes = { + data: PropTypes.object, pageContext, }; +export const pageQuery = graphql` + query { + allMdx(filter: { frontmatter: { promoteToHomepage: { eq: true } } }) { + nodes { + frontmatter { + title + description + duration + path + callout { + title + description + } + } + } + } + } +`; + export default IndexPage;