diff --git a/studio/schemas/shortForm.js b/studio/schemas/shortForm.js
index b555b196..a2b19806 100644
--- a/studio/schemas/shortForm.js
+++ b/studio/schemas/shortForm.js
@@ -19,6 +19,11 @@ export default {
maxLength: 96,
},
},
+ {
+ name: "mainImage",
+ title: "Main image",
+ type: "mainImage",
+ },
{
name: "slideshow",
title: "Slideshow",
diff --git a/web/src/pages/index.js b/web/src/pages/index.js
index ca900c23..1d954920 100644
--- a/web/src/pages/index.js
+++ b/web/src/pages/index.js
@@ -1,7 +1,8 @@
import React from "react";
import { graphql } from "gatsby";
-import { Grid } from "theme-ui";
+import { Divider, Grid, Themed } from "theme-ui";
import { mapEdgesToNodes, filterOutDocsWithoutSlugs } from "../lib/helpers";
+import ArticlePreview from "../components/article-layouts/article-preview";
import BlockContent from "../components/block-content";
import Container from "../components/core/container";
import GraphQLErrorList from "../components/core/graphql-error-list";
@@ -63,6 +64,45 @@ export const query = graphql`
}
}
}
+ shortForms: allSanityShortForm(
+ limit: 1
+ sort: { fields: [publishedAt], order: DESC }
+ ) {
+ edges {
+ node {
+ id
+ publishedAt
+ mainImage {
+ crop {
+ _key
+ _type
+ top
+ bottom
+ left
+ right
+ }
+ hotspot {
+ _key
+ _type
+ x
+ y
+ height
+ width
+ }
+ asset {
+ _id
+ }
+ alt
+ }
+ title
+ _rawExcerpt
+ _rawMembers(resolveReferences: { maxDepth: 5 })
+ slug {
+ current
+ }
+ }
+ }
+ }
}
`;
@@ -83,6 +123,10 @@ const IndexPage = (props) => {
? mapEdgesToNodes(data.projects).filter(filterOutDocsWithoutSlugs)
: [];
+ const shortFormNodes = (data || {}).shortForms
+ ? mapEdgesToNodes(data.shortForms).filter(filterOutDocsWithoutSlugs)
+ : [];
+
if (!site) {
throw new Error(
'Missing "Site settings". Open the studio at http://localhost:3333 and add some content to "Site settings" and restart the development server.'
@@ -128,6 +172,15 @@ const IndexPage = (props) => {
+ Featured Short Form
+ {shortFormNodes && (
+
+ )}
+