soames-gatsby-theme 0.1.7 → 0.1.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,24 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const jsx_runtime_1 = require("react/jsx-runtime");
4
- const HeroHeader = ({ title, subhead, backgroundImage, backgroundImageTitle, overlayOpacity, }) => {
4
+ const HeroHeader = ({ title, subhead, backgroundImage, overlayOpacity, }) => {
5
5
  if (!backgroundImage) {
6
6
  backgroundImage = "https://picsum.photos/1080/720";
7
7
  }
8
- else {
9
- if (backgroundImageTitle?.includes("_02o_"))
10
- overlayOpacity = 0.2;
11
- else if (backgroundImageTitle?.includes("_03o_"))
12
- overlayOpacity = 0.3;
13
- else if (backgroundImageTitle?.includes("_04o_"))
14
- overlayOpacity = 0.4;
15
- else if (backgroundImageTitle?.includes("_05o_"))
16
- overlayOpacity = 0.5;
17
- else if (backgroundImageTitle?.includes("_06o_"))
18
- overlayOpacity = 0.6;
19
- else if (backgroundImageTitle?.includes("_07o_"))
20
- overlayOpacity = 0.7;
21
- }
22
8
  if (!overlayOpacity) {
23
9
  overlayOpacity = 0.6;
24
10
  }
@@ -9,7 +9,10 @@ const html_react_parser_1 = __importDefault(require("html-react-parser"));
9
9
  const Layout_1 = __importDefault(require("../components/Layout"));
10
10
  const Seo_1 = __importDefault(require("../components/Seo"));
11
11
  const HeroHeader_1 = __importDefault(require("../components/HeroHeader"));
12
+ const Bio_1 = __importDefault(require("../components/Bio"));
13
+ const BlogSidebar_1 = __importDefault(require("../components/BlogSidebar"));
12
14
  const Shortcodes_1 = require("../utils/shortcodes/Shortcodes");
15
+ require("../styles/vendor/wordpress-blocks.css");
13
16
  const PreviewPage = () => {
14
17
  const [content, setContent] = (0, react_1.useState)(null);
15
18
  const [loading, setLoading] = (0, react_1.useState)(true);
@@ -54,8 +57,21 @@ const PreviewPage = () => {
54
57
  if (error || !content) {
55
58
  return ((0, jsx_runtime_1.jsxs)(Layout_1.default, { children: [(0, jsx_runtime_1.jsx)(Seo_1.default, { title: "Preview Unavailable" }), (0, jsx_runtime_1.jsxs)("section", { style: { padding: "4rem 2rem", textAlign: "center" }, children: [(0, jsx_runtime_1.jsx)("h2", { children: "Preview Unavailable" }), (0, jsx_runtime_1.jsx)("p", { children: error ?? "No preview content found." })] })] }));
56
59
  }
57
- const backgroundImage = content.featuredImage?.sourceUrl ?? null;
58
- const backgroundImageTitle = content.title ?? null;
59
- return ((0, jsx_runtime_1.jsxs)(Layout_1.default, { children: [(0, jsx_runtime_1.jsx)(Seo_1.default, { title: `Preview: ${content.title ?? ""}` }), (0, jsx_runtime_1.jsx)(HeroHeader_1.default, { title: content.title ? (0, html_react_parser_1.default)(content.title) : "Preview", subhead: content.excerpt ? (0, html_react_parser_1.default)(content.excerpt) : "", backgroundImage: backgroundImage, backgroundImageTitle: backgroundImageTitle }), content.type === "post" ? ((0, jsx_runtime_1.jsx)("section", { children: (0, jsx_runtime_1.jsx)("div", { className: "media-container-row", children: (0, jsx_runtime_1.jsx)("div", { className: "col-12 col-lg-8", children: (0, jsx_runtime_1.jsx)("section", { id: "soames-gatsby-content-container", className: "soames-gatsby-blog-content", children: (0, jsx_runtime_1.jsxs)("article", { className: "blog-post", children: [(0, jsx_runtime_1.jsxs)("header", { children: [(0, jsx_runtime_1.jsx)("h1", { children: content.title ? (0, html_react_parser_1.default)(content.title) : "" }), content.date && (0, jsx_runtime_1.jsx)("p", { children: content.date })] }), content.content && ((0, jsx_runtime_1.jsx)("section", { className: "blog-post-content", children: (0, html_react_parser_1.default)(content.content) }))] }) }) }) }) })) : (content.content && ((0, jsx_runtime_1.jsx)("section", { id: "soames-gatsby-content-container", className: "soames-gatsby-content", children: (0, jsx_runtime_1.jsx)(Shortcodes_1.Shortcodes, { children: content.content }) })))] }));
60
+ const isPost = content.type === "post";
61
+ // For posts, HeroHeader mirrors the Blog archive page hero (matching blog-post.tsx).
62
+ // For pages, use the page's own title and featured image (matching page.tsx).
63
+ const heroTitle = isPost
64
+ ? (content.blogHero?.title ? (0, html_react_parser_1.default)(content.blogHero.title) : "Blog")
65
+ : (content.title ? (0, html_react_parser_1.default)(content.title) : "Preview");
66
+ const heroSubhead = isPost
67
+ ? (content.blogHero?.excerpt ? (0, html_react_parser_1.default)(content.blogHero.excerpt) : "")
68
+ : (content.excerpt ? (0, html_react_parser_1.default)(content.excerpt) : "");
69
+ const heroBg = isPost
70
+ ? (content.blogHero?.guid ?? null)
71
+ : (content.featuredImage?.sourceUrl ?? null);
72
+ const heroOpacityStr = isPost
73
+ ? (content.blogHero?.overlayOpacity ?? null)
74
+ : (content.overlayOpacity ?? null);
75
+ return ((0, jsx_runtime_1.jsxs)(Layout_1.default, { children: [(0, jsx_runtime_1.jsx)(Seo_1.default, { title: `Preview: ${content.title ?? ""}` }), (0, jsx_runtime_1.jsx)(HeroHeader_1.default, { title: heroTitle, subhead: heroSubhead, backgroundImage: heroBg, overlayOpacity: heroOpacityStr ? parseFloat(heroOpacityStr) : undefined }), isPost ? ((0, jsx_runtime_1.jsx)("section", { children: (0, jsx_runtime_1.jsxs)("div", { className: "media-container-row", children: [(0, jsx_runtime_1.jsx)("div", { className: "col-12 col-lg-8", children: (0, jsx_runtime_1.jsx)("section", { id: "soames-gatsby-content-container", className: "soames-gatsby-blog-content", children: (0, jsx_runtime_1.jsxs)("article", { className: "blog-post", itemScope: true, itemType: "http://schema.org/Article", children: [(0, jsx_runtime_1.jsxs)("header", { children: [(0, jsx_runtime_1.jsx)("h1", { itemProp: "headline", children: content.title ? (0, html_react_parser_1.default)(content.title) : "" }), content.date && (0, jsx_runtime_1.jsx)("p", { children: content.date })] }), content.content && ((0, jsx_runtime_1.jsx)("section", { itemProp: "articleBody", className: "blog-post-content", children: (0, html_react_parser_1.default)(content.content) })), (0, jsx_runtime_1.jsx)("hr", {}), (0, jsx_runtime_1.jsx)("footer", { children: (0, jsx_runtime_1.jsx)(Bio_1.default, {}) })] }) }) }), (0, jsx_runtime_1.jsx)("div", { className: "col-12 col-lg-4", children: (0, jsx_runtime_1.jsxs)("section", { id: "soames-gatsby-sidebar-container", className: "soames-gatsby-sidebar", children: [content.featuredImage?.sourceUrl && ((0, jsx_runtime_1.jsx)("img", { src: content.featuredImage.sourceUrl, alt: content.featuredImage.altText || "", style: { marginBottom: 50, width: "100%" } })), (0, jsx_runtime_1.jsx)("h1", { children: "Recent Posts" }), (0, jsx_runtime_1.jsx)(BlogSidebar_1.default, { postId: "" })] }) })] }) })) : (content.content && ((0, jsx_runtime_1.jsx)("section", { id: "soames-gatsby-content-container", className: "soames-gatsby-content", children: (0, jsx_runtime_1.jsx)(Shortcodes_1.Shortcodes, { children: content.content }) })))] }));
60
76
  };
61
77
  exports.default = PreviewPage;
@@ -15,7 +15,7 @@ const BlogIndex = ({ data, pageContext }) => {
15
15
  const archive = data.wpPage;
16
16
  const { nextPagePath, previousPagePath } = pageContext;
17
17
  if (!posts.length) {
18
- return ((0, jsx_runtime_1.jsxs)(Layout_1.default, { children: [(0, jsx_runtime_1.jsx)(Seo_1.default, { title: "All posts" }), (0, jsx_runtime_1.jsx)(HeroHeader_1.default, { title: archive.title ? (0, html_react_parser_1.default)(archive.title) : "Blog", subhead: archive.excerpt ? (0, html_react_parser_1.default)(archive.excerpt) : "", backgroundImage: archive.featuredImage?.node.guid || null, backgroundImageTitle: archive.featuredImage?.node.title || null }), (0, jsx_runtime_1.jsx)("p", { children: "No blog posts found. Add posts to your WordPress site and they'll appear here!" })] }));
18
+ return ((0, jsx_runtime_1.jsxs)(Layout_1.default, { children: [(0, jsx_runtime_1.jsx)(Seo_1.default, { title: "All posts" }), (0, jsx_runtime_1.jsx)(HeroHeader_1.default, { title: archive.title ? (0, html_react_parser_1.default)(archive.title) : "Blog", subhead: archive.excerpt ? (0, html_react_parser_1.default)(archive.excerpt) : "", backgroundImage: archive.featuredImage?.node.guid || null, overlayOpacity: archive.overlayOpacity ? parseFloat(archive.overlayOpacity) : undefined }), (0, jsx_runtime_1.jsx)("p", { children: "No blog posts found. Add posts to your WordPress site and they'll appear here!" })] }));
19
19
  }
20
20
  const groupedPosts = posts.reduce((groups, post, index) => {
21
21
  if (index % 3 === 0) {
@@ -26,7 +26,7 @@ const BlogIndex = ({ data, pageContext }) => {
26
26
  }
27
27
  return groups;
28
28
  }, []);
29
- return ((0, jsx_runtime_1.jsxs)(Layout_1.default, { isHomePage: true, children: [(0, jsx_runtime_1.jsx)(Seo_1.default, { title: "All posts" }), (0, jsx_runtime_1.jsx)(HeroHeader_1.default, { title: archive.title ? (0, html_react_parser_1.default)(archive.title) : "Blog", subhead: archive.excerpt ? (0, html_react_parser_1.default)(archive.excerpt) : "", backgroundImage: archive.featuredImage?.node.guid || null, backgroundImageTitle: archive.featuredImage?.node.title || null }), (0, jsx_runtime_1.jsx)("section", { className: "soames-blog-roll", children: (0, jsx_runtime_1.jsx)("div", { className: "container", children: groupedPosts.map((group, index) => ((0, jsx_runtime_1.jsx)("div", { className: "media-container-row", children: group.map((post, idx) => ((0, jsx_runtime_1.jsx)("div", { className: "card p-3 col-12 col-lg-4", children: (0, jsx_runtime_1.jsxs)("div", { className: "card-wrapper", children: [(0, jsx_runtime_1.jsxs)("div", { className: "card-box", children: [(0, jsx_runtime_1.jsx)("h4", { className: "card-title mbr-fonts-style display-5", children: (0, html_react_parser_1.default)(post.title) }), (0, jsx_runtime_1.jsx)("h4", { className: "mbr-fonts-style display-7", children: post.date }), (0, html_react_parser_1.default)(post.excerpt)] }), (0, jsx_runtime_1.jsx)("div", { className: "mbr-section-btn text-center", children: (0, jsx_runtime_1.jsx)(gatsby_1.Link, { to: `/blog${post.uri}`, itemProp: "url", className: "btn btn-primary display-4", children: (0, jsx_runtime_1.jsx)("span", { itemProp: "headline", children: "Read More" }) }) })] }) }, idx))) }, index))) }) }), (0, jsx_runtime_1.jsxs)("section", { children: [previousPagePath && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(gatsby_1.Link, { to: `/blog${previousPagePath}`, children: "Previous page" }), (0, jsx_runtime_1.jsx)("br", {})] })), nextPagePath && (0, jsx_runtime_1.jsx)(gatsby_1.Link, { to: `/blog${nextPagePath}`, children: "Next page" })] })] }));
29
+ return ((0, jsx_runtime_1.jsxs)(Layout_1.default, { isHomePage: true, children: [(0, jsx_runtime_1.jsx)(Seo_1.default, { title: "All posts" }), (0, jsx_runtime_1.jsx)(HeroHeader_1.default, { title: archive.title ? (0, html_react_parser_1.default)(archive.title) : "Blog", subhead: archive.excerpt ? (0, html_react_parser_1.default)(archive.excerpt) : "", backgroundImage: archive.featuredImage?.node.guid || null, overlayOpacity: archive.overlayOpacity ? parseFloat(archive.overlayOpacity) : undefined }), (0, jsx_runtime_1.jsx)("section", { className: "soames-blog-roll", children: (0, jsx_runtime_1.jsx)("div", { className: "container", children: groupedPosts.map((group, index) => ((0, jsx_runtime_1.jsx)("div", { className: "media-container-row", children: group.map((post, idx) => ((0, jsx_runtime_1.jsx)("div", { className: "card p-3 col-12 col-lg-4", children: (0, jsx_runtime_1.jsxs)("div", { className: "card-wrapper", children: [(0, jsx_runtime_1.jsxs)("div", { className: "card-box", children: [(0, jsx_runtime_1.jsx)("h4", { className: "card-title mbr-fonts-style display-5", children: (0, html_react_parser_1.default)(post.title) }), (0, jsx_runtime_1.jsx)("h4", { className: "mbr-fonts-style display-7", children: post.date }), (0, html_react_parser_1.default)(post.excerpt)] }), (0, jsx_runtime_1.jsx)("div", { className: "mbr-section-btn text-center", children: (0, jsx_runtime_1.jsx)(gatsby_1.Link, { to: `/blog${post.uri}`, itemProp: "url", className: "btn btn-primary display-4", children: (0, jsx_runtime_1.jsx)("span", { itemProp: "headline", children: "Read More" }) }) })] }) }, idx))) }, index))) }) }), (0, jsx_runtime_1.jsxs)("section", { children: [previousPagePath && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(gatsby_1.Link, { to: `/blog${previousPagePath}`, children: "Previous page" }), (0, jsx_runtime_1.jsx)("br", {})] })), nextPagePath && (0, jsx_runtime_1.jsx)(gatsby_1.Link, { to: `/blog${nextPagePath}`, children: "Next page" })] })] }));
30
30
  };
31
31
  exports.default = BlogIndex;
32
32
  exports.pageQuery = (0, gatsby_1.graphql) `
@@ -48,10 +48,10 @@ exports.pageQuery = (0, gatsby_1.graphql) `
48
48
  wpPage(isPostsPage: { eq: true }) {
49
49
  title
50
50
  excerpt
51
+ overlayOpacity
51
52
  featuredImage {
52
53
  node {
53
54
  guid
54
- title
55
55
  }
56
56
  }
57
57
  }
@@ -18,7 +18,7 @@ const BlogPostTemplate = ({ data }) => {
18
18
  const { post, previous, next, page } = data;
19
19
  const featuredImageData = post.featuredImage?.node?.gatsbyImage ?? null;
20
20
  const featuredImageAlt = post.featuredImage?.node?.altText || "Featured image";
21
- return ((0, jsx_runtime_1.jsxs)(Layout_1.default, { children: [(0, jsx_runtime_1.jsx)(Seo_1.default, { title: post.title || "", description: post.excerpt || undefined }), (0, jsx_runtime_1.jsx)(HeroHeader_1.default, { title: page?.title ? (0, html_react_parser_1.default)(page.title) : "Blog", subhead: page?.excerpt ? (0, html_react_parser_1.default)(page.excerpt) : "", backgroundImage: page?.featuredImage?.node?.guid || null, backgroundImageTitle: page?.title || null }), (0, jsx_runtime_1.jsx)("section", { children: (0, jsx_runtime_1.jsxs)("div", { className: "media-container-row", children: [(0, jsx_runtime_1.jsx)("div", { className: "col-12 col-lg-8", children: (0, jsx_runtime_1.jsxs)("section", { id: "soames-gatsby-content-container", className: "soames-gatsby-blog-content", children: [(0, jsx_runtime_1.jsxs)("article", { className: "blog-post", itemScope: true, itemType: "http://schema.org/Article", children: [(0, jsx_runtime_1.jsxs)("header", { children: [(0, jsx_runtime_1.jsx)("h1", { itemProp: "headline", children: post.title ? (0, html_react_parser_1.default)(post.title) : "" }), (0, jsx_runtime_1.jsx)("p", { children: post.date })] }), post.content && ((0, jsx_runtime_1.jsx)("section", { itemProp: "articleBody", className: "blog-post-content", children: (0, html_react_parser_1.default)(post.content) })), (0, jsx_runtime_1.jsx)("hr", {}), (0, jsx_runtime_1.jsx)("footer", { children: (0, jsx_runtime_1.jsx)(Bio_1.default, {}) })] }), (0, jsx_runtime_1.jsx)("nav", { className: "blog-post-nav", children: (0, jsx_runtime_1.jsxs)("ul", { style: {
21
+ return ((0, jsx_runtime_1.jsxs)(Layout_1.default, { children: [(0, jsx_runtime_1.jsx)(Seo_1.default, { title: post.title || "", description: post.excerpt || undefined }), (0, jsx_runtime_1.jsx)(HeroHeader_1.default, { title: page?.title ? (0, html_react_parser_1.default)(page.title) : "Blog", subhead: page?.excerpt ? (0, html_react_parser_1.default)(page.excerpt) : "", backgroundImage: page?.featuredImage?.node?.guid || null, overlayOpacity: page?.overlayOpacity ? parseFloat(page.overlayOpacity) : undefined }), (0, jsx_runtime_1.jsx)("section", { children: (0, jsx_runtime_1.jsxs)("div", { className: "media-container-row", children: [(0, jsx_runtime_1.jsx)("div", { className: "col-12 col-lg-8", children: (0, jsx_runtime_1.jsxs)("section", { id: "soames-gatsby-content-container", className: "soames-gatsby-blog-content", children: [(0, jsx_runtime_1.jsxs)("article", { className: "blog-post", itemScope: true, itemType: "http://schema.org/Article", children: [(0, jsx_runtime_1.jsxs)("header", { children: [(0, jsx_runtime_1.jsx)("h1", { itemProp: "headline", children: post.title ? (0, html_react_parser_1.default)(post.title) : "" }), (0, jsx_runtime_1.jsx)("p", { children: post.date })] }), post.content && ((0, jsx_runtime_1.jsx)("section", { itemProp: "articleBody", className: "blog-post-content", children: (0, html_react_parser_1.default)(post.content) })), (0, jsx_runtime_1.jsx)("hr", {}), (0, jsx_runtime_1.jsx)("footer", { children: (0, jsx_runtime_1.jsx)(Bio_1.default, {}) })] }), (0, jsx_runtime_1.jsx)("nav", { className: "blog-post-nav", children: (0, jsx_runtime_1.jsxs)("ul", { style: {
22
22
  display: `flex`,
23
23
  flexWrap: `wrap`,
24
24
  justifyContent: `space-between`,
@@ -57,6 +57,7 @@ exports.pageQuery = (0, gatsby_1.graphql) `
57
57
  page: wpPage(isPostsPage: { eq: true }) {
58
58
  title
59
59
  excerpt
60
+ overlayOpacity
60
61
  featuredImage {
61
62
  node {
62
63
  guid
@@ -13,7 +13,7 @@ const HeroHeader_1 = __importDefault(require("../components/HeroHeader"));
13
13
  const Shortcodes_1 = require("../utils/shortcodes/Shortcodes");
14
14
  // Gutenberg block styles
15
15
  require("../styles/vendor/wordpress-blocks.css");
16
- const Page = ({ data: { page } }) => ((0, jsx_runtime_1.jsxs)(Layout_1.default, { children: [(0, jsx_runtime_1.jsx)(Seo_1.default, { title: page.title }), (0, jsx_runtime_1.jsx)(HeroHeader_1.default, { title: (0, html_react_parser_1.default)(page.title), subhead: page.excerpt ? (0, html_react_parser_1.default)(page.excerpt) : "", backgroundImage: page.featuredImage?.node.guid || null, backgroundImageTitle: page.featuredImage?.node.title || null }), page.content && ((0, jsx_runtime_1.jsx)("section", { id: "soames-gatsby-content-container", className: "soames-gatsby-content", children: (0, jsx_runtime_1.jsx)(Shortcodes_1.Shortcodes, { children: page.content }) }))] }));
16
+ const Page = ({ data: { page } }) => ((0, jsx_runtime_1.jsxs)(Layout_1.default, { children: [(0, jsx_runtime_1.jsx)(Seo_1.default, { title: page.title }), (0, jsx_runtime_1.jsx)(HeroHeader_1.default, { title: (0, html_react_parser_1.default)(page.title), subhead: page.excerpt ? (0, html_react_parser_1.default)(page.excerpt) : "", backgroundImage: page.featuredImage?.node.guid || null, overlayOpacity: page.overlayOpacity ? parseFloat(page.overlayOpacity) : undefined }), page.content && ((0, jsx_runtime_1.jsx)("section", { id: "soames-gatsby-content-container", className: "soames-gatsby-content", children: (0, jsx_runtime_1.jsx)(Shortcodes_1.Shortcodes, { children: page.content }) }))] }));
17
17
  exports.default = Page;
18
18
  exports.pageQuery = (0, gatsby_1.graphql) `
19
19
  query PageById($id: String!) {
@@ -22,9 +22,9 @@ exports.pageQuery = (0, gatsby_1.graphql) `
22
22
  title
23
23
  excerpt
24
24
  content
25
+ overlayOpacity
25
26
  featuredImage {
26
27
  node {
27
- title
28
28
  guid
29
29
  }
30
30
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "soames-gatsby-theme",
3
- "version": "0.1.7",
3
+ "version": "0.1.9",
4
4
  "description": "A customizable Gatsby theme for personal websites using WordPress as a headless CMS.",
5
5
  "main": "dist/gatsby-config.js",
6
6
  "scripts": {
@@ -4,7 +4,6 @@ export interface HeroHeaderProps {
4
4
  title: React.ReactNode;
5
5
  subhead?: React.ReactNode;
6
6
  backgroundImage?: string | null;
7
- backgroundImageTitle?: string | null;
8
7
  overlayOpacity?: number;
9
8
  }
10
9
 
@@ -12,18 +11,10 @@ const HeroHeader = ({
12
11
  title,
13
12
  subhead,
14
13
  backgroundImage,
15
- backgroundImageTitle,
16
14
  overlayOpacity,
17
15
  }: HeroHeaderProps) => {
18
16
  if (!backgroundImage) {
19
17
  backgroundImage = "https://picsum.photos/1080/720";
20
- } else {
21
- if (backgroundImageTitle?.includes("_02o_")) overlayOpacity = 0.2;
22
- else if (backgroundImageTitle?.includes("_03o_")) overlayOpacity = 0.3;
23
- else if (backgroundImageTitle?.includes("_04o_")) overlayOpacity = 0.4;
24
- else if (backgroundImageTitle?.includes("_05o_")) overlayOpacity = 0.5;
25
- else if (backgroundImageTitle?.includes("_06o_")) overlayOpacity = 0.6;
26
- else if (backgroundImageTitle?.includes("_07o_")) overlayOpacity = 0.7;
27
18
  }
28
19
 
29
20
  if (!overlayOpacity) {
@@ -3,20 +3,32 @@ import parse from "html-react-parser";
3
3
  import Layout from "../components/Layout";
4
4
  import Seo from "../components/Seo";
5
5
  import HeroHeader from "../components/HeroHeader";
6
+ import Bio from "../components/Bio";
7
+ import BlogSidebar from "../components/BlogSidebar";
6
8
  import { Shortcodes } from "../utils/shortcodes/Shortcodes";
9
+ import "../styles/vendor/wordpress-blocks.css";
7
10
 
8
11
  interface FeaturedImage {
9
12
  sourceUrl?: string;
10
13
  altText?: string;
11
14
  }
12
15
 
16
+ interface BlogHero {
17
+ title?: string | null;
18
+ excerpt?: string | null;
19
+ guid?: string | null;
20
+ overlayOpacity?: string | null;
21
+ }
22
+
13
23
  interface PreviewContent {
14
24
  type: string;
15
25
  title?: string;
16
26
  content?: string;
17
27
  excerpt?: string;
18
28
  date?: string;
29
+ overlayOpacity?: string | null;
19
30
  featuredImage?: FeaturedImage | null;
31
+ blogHero?: BlogHero | null;
20
32
  }
21
33
 
22
34
  const PreviewPage: React.FC = () => {
@@ -86,19 +98,33 @@ const PreviewPage: React.FC = () => {
86
98
  );
87
99
  }
88
100
 
89
- const backgroundImage = content.featuredImage?.sourceUrl ?? null;
90
- const backgroundImageTitle = content.title ?? null;
101
+ const isPost = content.type === "post";
102
+
103
+ // For posts, HeroHeader mirrors the Blog archive page hero (matching blog-post.tsx).
104
+ // For pages, use the page's own title and featured image (matching page.tsx).
105
+ const heroTitle = isPost
106
+ ? (content.blogHero?.title ? parse(content.blogHero.title) : "Blog")
107
+ : (content.title ? parse(content.title) : "Preview");
108
+ const heroSubhead = isPost
109
+ ? (content.blogHero?.excerpt ? parse(content.blogHero.excerpt) : "")
110
+ : (content.excerpt ? parse(content.excerpt) : "");
111
+ const heroBg = isPost
112
+ ? (content.blogHero?.guid ?? null)
113
+ : (content.featuredImage?.sourceUrl ?? null);
114
+ const heroOpacityStr = isPost
115
+ ? (content.blogHero?.overlayOpacity ?? null)
116
+ : (content.overlayOpacity ?? null);
91
117
 
92
118
  return (
93
119
  <Layout>
94
120
  <Seo title={`Preview: ${content.title ?? ""}`} />
95
121
  <HeroHeader
96
- title={content.title ? parse(content.title) : "Preview"}
97
- subhead={content.excerpt ? parse(content.excerpt) : ""}
98
- backgroundImage={backgroundImage}
99
- backgroundImageTitle={backgroundImageTitle}
122
+ title={heroTitle}
123
+ subhead={heroSubhead}
124
+ backgroundImage={heroBg}
125
+ overlayOpacity={heroOpacityStr ? parseFloat(heroOpacityStr) : undefined}
100
126
  />
101
- {content.type === "post" ? (
127
+ {isPost ? (
102
128
  <section>
103
129
  <div className="media-container-row">
104
130
  <div className="col-12 col-lg-8">
@@ -106,19 +132,48 @@ const PreviewPage: React.FC = () => {
106
132
  id="soames-gatsby-content-container"
107
133
  className="soames-gatsby-blog-content"
108
134
  >
109
- <article className="blog-post">
135
+ <article
136
+ className="blog-post"
137
+ itemScope
138
+ itemType="http://schema.org/Article"
139
+ >
110
140
  <header>
111
- <h1>{content.title ? parse(content.title) : ""}</h1>
141
+ <h1 itemProp="headline">
142
+ {content.title ? parse(content.title) : ""}
143
+ </h1>
112
144
  {content.date && <p>{content.date}</p>}
113
145
  </header>
114
146
  {content.content && (
115
- <section className="blog-post-content">
147
+ <section
148
+ itemProp="articleBody"
149
+ className="blog-post-content"
150
+ >
116
151
  {parse(content.content)}
117
152
  </section>
118
153
  )}
154
+ <hr />
155
+ <footer>
156
+ <Bio />
157
+ </footer>
119
158
  </article>
120
159
  </section>
121
160
  </div>
161
+ <div className="col-12 col-lg-4">
162
+ <section
163
+ id="soames-gatsby-sidebar-container"
164
+ className="soames-gatsby-sidebar"
165
+ >
166
+ {content.featuredImage?.sourceUrl && (
167
+ <img
168
+ src={content.featuredImage.sourceUrl}
169
+ alt={content.featuredImage.altText || ""}
170
+ style={{ marginBottom: 50, width: "100%" }}
171
+ />
172
+ )}
173
+ <h1>Recent Posts</h1>
174
+ <BlogSidebar postId="" />
175
+ </section>
176
+ </div>
122
177
  </div>
123
178
  </section>
124
179
  ) : (
@@ -22,10 +22,10 @@ interface PostNode {
22
22
  interface ArchivePage {
23
23
  title: string;
24
24
  excerpt: string;
25
+ overlayOpacity?: string | null;
25
26
  featuredImage?: {
26
27
  node: {
27
28
  guid: string;
28
- title: string;
29
29
  };
30
30
  };
31
31
  }
@@ -53,7 +53,7 @@ const BlogIndex: React.FC<BlogPostArchiveProps> = ({ data, pageContext }) => {
53
53
  title={archive.title ? parse(archive.title) : "Blog"}
54
54
  subhead={archive.excerpt ? parse(archive.excerpt) : ""}
55
55
  backgroundImage={archive.featuredImage?.node.guid || null}
56
- backgroundImageTitle={archive.featuredImage?.node.title || null}
56
+ overlayOpacity={archive.overlayOpacity ? parseFloat(archive.overlayOpacity) : undefined}
57
57
  />
58
58
  <p>
59
59
  No blog posts found. Add posts to your WordPress site and they'll appear here!
@@ -78,7 +78,7 @@ const BlogIndex: React.FC<BlogPostArchiveProps> = ({ data, pageContext }) => {
78
78
  title={archive.title ? parse(archive.title) : "Blog"}
79
79
  subhead={archive.excerpt ? parse(archive.excerpt) : ""}
80
80
  backgroundImage={archive.featuredImage?.node.guid || null}
81
- backgroundImageTitle={archive.featuredImage?.node.title || null}
81
+ overlayOpacity={archive.overlayOpacity ? parseFloat(archive.overlayOpacity) : undefined}
82
82
  />
83
83
 
84
84
  <section className="soames-blog-roll">
@@ -156,10 +156,10 @@ export const pageQuery = graphql`
156
156
  wpPage(isPostsPage: { eq: true }) {
157
157
  title
158
158
  excerpt
159
+ overlayOpacity
159
160
  featuredImage {
160
161
  node {
161
162
  guid
162
- title
163
163
  }
164
164
  }
165
165
  }
@@ -32,6 +32,7 @@ interface Post {
32
32
  interface Page {
33
33
  title?: string | null;
34
34
  excerpt?: string | null;
35
+ overlayOpacity?: string | null;
35
36
  featuredImage?: {
36
37
  node: {
37
38
  guid?: string | null;
@@ -66,7 +67,7 @@ const BlogPostTemplate: React.FC<BlogPostTemplateProps> = ({ data }) => {
66
67
  title={page?.title ? parse(page.title) : "Blog"}
67
68
  subhead={page?.excerpt ? parse(page.excerpt) : ""}
68
69
  backgroundImage={page?.featuredImage?.node?.guid || null}
69
- backgroundImageTitle={page?.title || null}
70
+ overlayOpacity={page?.overlayOpacity ? parseFloat(page.overlayOpacity) : undefined}
70
71
  />
71
72
  <section>
72
73
  <div className="media-container-row">
@@ -173,6 +174,7 @@ export const pageQuery = graphql`
173
174
  page: wpPage(isPostsPage: { eq: true }) {
174
175
  title
175
176
  excerpt
177
+ overlayOpacity
176
178
  featuredImage {
177
179
  node {
178
180
  guid
@@ -16,9 +16,9 @@ type PageTemplateProps = PageProps<{
16
16
  title: string;
17
17
  excerpt?: string;
18
18
  content?: string;
19
+ overlayOpacity?: string | null;
19
20
  featuredImage?: {
20
21
  node: {
21
- title: string;
22
22
  guid: string;
23
23
  };
24
24
  };
@@ -32,7 +32,7 @@ const Page: React.FC<PageTemplateProps> = ({ data: { page } }) => (
32
32
  title={parse(page.title)}
33
33
  subhead={page.excerpt ? parse(page.excerpt) : ""}
34
34
  backgroundImage={page.featuredImage?.node.guid || null}
35
- backgroundImageTitle={page.featuredImage?.node.title || null}
35
+ overlayOpacity={page.overlayOpacity ? parseFloat(page.overlayOpacity) : undefined}
36
36
  />
37
37
  {page.content && (
38
38
  <section
@@ -54,9 +54,9 @@ export const pageQuery = graphql`
54
54
  title
55
55
  excerpt
56
56
  content
57
+ overlayOpacity
57
58
  featuredImage {
58
59
  node {
59
- title
60
60
  guid
61
61
  }
62
62
  }