diff --git a/gatsby-config.js b/gatsby-config.js
index e872449..dc5abfb 100644
--- a/gatsby-config.js
+++ b/gatsby-config.js
@@ -18,8 +18,8 @@ module.exports = {
{
resolve: 'gatsby-source-filesystem',
options: {
- path: `${__dirname}/content`,
- name: 'pages'
+ path: `${__dirname}/static`,
+ name: 'assets'
}
},
{
@@ -32,15 +32,15 @@ module.exports = {
{
resolve: 'gatsby-source-filesystem',
options: {
- name: 'css',
- path: `${__dirname}/static/css`
+ path: `${__dirname}/content`,
+ name: 'pages'
}
},
{
resolve: 'gatsby-source-filesystem',
options: {
- name: 'assets',
- path: `${__dirname}/static`
+ name: 'css',
+ path: `${__dirname}/static/css`
}
},
{
diff --git a/src/components/Layout/Layout.js b/src/components/Layout/Layout.js
index eab3d9d..e1cf2a8 100644
--- a/src/components/Layout/Layout.js
+++ b/src/components/Layout/Layout.js
@@ -1,7 +1,6 @@
// @flow strict
import React from 'react';
import Helmet from 'react-helmet';
-import { withPrefix } from 'gatsby';
import type { Node as ReactNode } from 'react';
import { useSiteMetadata } from '../../hooks';
import styles from './Layout.module.scss';
@@ -21,7 +20,7 @@ const Layout = ({
}: Props) => {
const { author, url } = useSiteMetadata();
const metaImage = socialImage != null ? socialImage : author.photo;
- const metaImageUrl = url + withPrefix(metaImage);
+ const metaImageUrl = url + metaImage;
return (
diff --git a/src/templates/page-template.js b/src/templates/page-template.js
index ce6f2ce..1511d97 100644
--- a/src/templates/page-template.js
+++ b/src/templates/page-template.js
@@ -19,9 +19,10 @@ const PageTemplate = ({ data }: Props) => {
const { frontmatter } = data.markdownRemark;
const { title: pageTitle, description: pageDescription, socialImage } = frontmatter;
const metaDescription = pageDescription !== null ? pageDescription : siteSubtitle;
+ const socialImageUrl = socialImage ? socialImage['publicURL'] : '';
return (
-
+
@@ -39,7 +40,9 @@ export const query = graphql`
title
date
description
- socialImage
+ socialImage {
+ publicURL
+ }
}
}
}
diff --git a/src/templates/post-template.js b/src/templates/post-template.js
index 801bc1f..d7c4b63 100644
--- a/src/templates/post-template.js
+++ b/src/templates/post-template.js
@@ -17,9 +17,10 @@ const PostTemplate = ({ data }: Props) => {
const { frontmatter } = data.markdownRemark;
const { title: postTitle, description: postDescription, socialImage } = frontmatter;
const metaDescription = postDescription !== null ? postDescription : siteSubtitle;
+ const socialImageUrl = socialImage ? socialImage['publicURL'] : '';
return (
-
+
);
@@ -39,7 +40,9 @@ export const query = graphql`
description
tags
title
- socialImage
+ socialImage {
+ publicURL
+ }
}
}
}
diff --git a/src/types/index.js b/src/types/index.js
index d5a2836..ce07c24 100644
--- a/src/types/index.js
+++ b/src/types/index.js
@@ -26,7 +26,8 @@ export type Node = {
fields: {
slug: string,
categorySlug?: string,
- tagSlugs?: string[]
+ tagSlugs?: string[],
+ socialImageUrl?: string,
},
frontmatter: {
date: string,