diff --git a/src/components/organisms/Layout.tsx b/src/components/organisms/Layout.tsx
index 1ea2cb6..c0cc500 100644
--- a/src/components/organisms/Layout.tsx
+++ b/src/components/organisms/Layout.tsx
@@ -10,11 +10,12 @@ const pages = [
]
type LayoutProps = {
- pageTitle: string | ReactNode
+ pageTitle: string
+ preTitle?: ReactNode
children: ReactNode
}
-const Layout = ({ pageTitle, children }: LayoutProps) => {
+const Layout = ({ pageTitle, preTitle, children }: LayoutProps) => {
const theme = useTheme()
return (
@@ -58,6 +59,7 @@ const Layout = ({ pageTitle, children }: LayoutProps) => {
+ {preTitle}
{pageTitle}
{children}
diff --git a/src/images/nixos-restic.png b/src/images/nixos-restic.png
new file mode 100644
index 0000000..11d34c0
Binary files /dev/null and b/src/images/nixos-restic.png differ
diff --git a/src/pages/blog/index.tsx b/src/pages/blog/index.tsx
index 766afd7..36dcdca 100644
--- a/src/pages/blog/index.tsx
+++ b/src/pages/blog/index.tsx
@@ -1,8 +1,9 @@
import { ReactNode } from "react"
import { GatsbyLinkProps, graphql, Link, PageProps } from "gatsby"
import Layout from "../../components/organisms/Layout"
-import { Card, CardContent, Grid, Typography } from "@mui/material"
+import { Card, CardContent, CardMedia, Grid, Typography } from "@mui/material"
import styled from "@emotion/styled"
+import { GatsbyImage, getImage } from "gatsby-plugin-image"
type PostProps = {
size?: "normal" | "highlight"
@@ -21,9 +22,23 @@ const Post = ({ size = "normal", post }: PostProps) => {
}
`
+ const featuredImage = getImage(post.frontmatter?.featuredImage?.childImageSharp?.gatsbyImageData!)
+
return (
+ {featuredImage && (
+ (
+
+ )}
+ />
+ )}
@@ -71,6 +86,12 @@ export const query = graphql`
frontmatter {
title
published
+ featuredImage {
+ childImageSharp {
+ gatsbyImageData(height: 200)
+ }
+ }
+ featuredImageAlt
}
}
}
diff --git a/src/pages/blog/{mdx.slug}.tsx b/src/pages/blog/{mdx.slug}.tsx
index 9d7cbba..bca1d3a 100644
--- a/src/pages/blog/{mdx.slug}.tsx
+++ b/src/pages/blog/{mdx.slug}.tsx
@@ -1,17 +1,22 @@
import React from "react"
import { graphql, Link as GatsbyLink, PageProps } from "gatsby"
+import { GatsbyImage, getImage } from "gatsby-plugin-image"
import { MDXRenderer } from "gatsby-plugin-mdx"
import NavigateNextIcon from "@mui/icons-material/NavigateNext"
import Layout from "../../components/organisms/Layout"
import { defineCustomElements as deckDeckGoHighlightElement } from "@deckdeckgo/highlight-code/dist/loader";
import { Breadcrumbs, Link } from "@mui/material";
+import { Box } from "@mui/system"
deckDeckGoHighlightElement();
const BlogPost = ({ data: { mdx }, path }: PageProps) => {
+ const featuredImage = getImage(mdx?.frontmatter?.featuredImage?.childImageSharp?.gatsbyImageData!)
+
return (
}
@@ -34,7 +39,14 @@ const BlogPost = ({ data: { mdx }, path }: PageProps) =>
{mdx?.frontmatter?.title}
- {mdx?.frontmatter?.title ?? ""}
+ {featuredImage && (
+
+
+
+ )}
>
}
>
@@ -54,6 +66,12 @@ export const query = graphql`
title
published
updated
+ featuredImage {
+ childImageSharp {
+ gatsbyImageData(width: 800)
+ }
+ }
+ featuredImageAlt
}
}
}
diff --git a/src/posts/nixos-restic-backups.mdx b/src/posts/nixos-restic-backups.mdx
index 9e1db67..3dc4ba3 100644
--- a/src/posts/nixos-restic-backups.mdx
+++ b/src/posts/nixos-restic-backups.mdx
@@ -2,6 +2,8 @@
title: Optimised Backups on NixOS with restic & fd
published: 2022-08-01
updated: 2022-08-01
+featuredImage: ../images/nixos-restic.png
+featuredImageAlt: NixOS plus Restic
---
#### UPDATE 2022-07-04