diff --git a/components/BlogPost.tsx b/components/BlogPost.tsx
index f4090ec..eae9361 100644
--- a/components/BlogPost.tsx
+++ b/components/BlogPost.tsx
@@ -1,18 +1,21 @@
-import Head from 'next/head';
-import React, { useEffect } from 'react';
+import { useEffect } from 'react';
import { useDispatch } from 'react-redux';
+import { METADATA } from '../constants';
import { PageType, setPageType, setPostTitle } from '../state/navigation';
import { IPost } from '../types/cms';
-import { generateTitle } from '../utils/metadata';
import { Article } from '../components/article/Article';
+import CustomHead from './CustomHead';
+
+interface Props {
+ post: IPost;
+}
// Parallax on bg as mouse moves
-export default function BlogPost({ post, url }: { post: IPost; url: string }) {
+export default function BlogPost(props: Props) {
+ const { post } = props;
const dispatch = useDispatch();
- const pageTitle = generateTitle(post?.title);
- const imageURL = post?.featureImage?.imageUrl;
useEffect(() => {
if (post) {
@@ -23,28 +26,23 @@ export default function BlogPost({ post, url }: { post: IPost; url: string }) {
return (
<>
-
- {pageTitle}
-
-
-
-
-
-
-
-
-
- {' '}
-
-
-
-
-
-
+
diff --git a/constants/metadata.tsx b/constants/metadata.tsx
index 8fbdc14..d6fe00f 100644
--- a/constants/metadata.tsx
+++ b/constants/metadata.tsx
@@ -20,6 +20,10 @@ export function generateTitle(prefix: string) {
: METADATA.TITLE;
}
+export function generateURL(prefix: string) {
+ return prefix ? `${METADATA.HOST_URL}${prefix}` : METADATA.HOST_URL;
+}
+
const METADATA = {
HOST_URL: 'https://oxen.io',
SITE_NAME: 'Oxen',
diff --git a/pages/[page].tsx b/pages/[page].tsx
index b8b2f39..a99d761 100644
--- a/pages/[page].tsx
+++ b/pages/[page].tsx
@@ -48,8 +48,8 @@ export const getStaticPaths: GetStaticPaths = async () => {
export async function getStaticProps({ params }) {
console.log(`Building Page %c${params.page}`, 'color: purple;');
- const href = params?.page ?? '';
- const id = unslugify(String(href));
+ const url = params?.page ?? '';
+ const id = unslugify(String(url));
try {
const cms = new CmsApi();
@@ -58,7 +58,7 @@ export async function getStaticProps({ params }) {
if (SideMenuItem[id]) {
page = await cms.fetchPageById(SideMenuItem[id]);
} else {
- page = await cms.fetchEntryBySlug(href, 'post');
+ page = await cms.fetchEntryBySlug(url, 'post');
// embedded links in post body need metadata for preview
page.body = await generateLinkMeta(page.body);
}
@@ -66,7 +66,6 @@ export async function getStaticProps({ params }) {
return {
props: {
page,
- href: `/${href}`,
},
revalidate: CMS.CONTENT_REVALIDATE_RATE,
};
@@ -79,15 +78,9 @@ export async function getStaticProps({ params }) {
}
}
-export default function Page({
- page,
- href,
-}: {
- page: ISplitPage | IPost;
- href: string;
-}) {
+export default function Page({ page }: { page: ISplitPage | IPost }) {
if (isPost(page)) {
- return ;
+ return ;
} else {
return ;
}
diff --git a/services/cms.tsx b/services/cms.tsx
index 9943348..22208d9 100644
--- a/services/cms.tsx
+++ b/services/cms.tsx
@@ -23,7 +23,7 @@ import {
ITagList,
} from '../types/cms';
import isLive from '../utils/environment';
-import { generateURL } from '../utils/metadata';
+import { generateURL } from '../constants/metadata';
import { fetchContent } from './embed';
function loadOptions(options: any) {
@@ -279,6 +279,7 @@ export class CmsApi {
body: rawPost.body ?? null,
subtitle: rawPost.subtitle ?? null,
description: rawPost.description ?? null,
+ publishedDateISO: rawPost.date,
publishedDate: format(parseISO(rawPost.date), 'dd MMMM yyyy'),
slug: rawPost.slug,
tags: rawPost?.tags, //?.map(t => t?.fields?.label) ?? [],
diff --git a/types/cms.ts b/types/cms.ts
index d5453e1..649dd00 100644
--- a/types/cms.ts
+++ b/types/cms.ts
@@ -28,6 +28,7 @@ export interface IPost {
description: string;
body: Document;
author?: IAuthor;
+ publishedDateISO: string;
publishedDate: string;
featureImage?: IFigureImage;
tags: Array;
diff --git a/utils/metadata.ts b/utils/metadata.ts
deleted file mode 100644
index e8d4654..0000000
--- a/utils/metadata.ts
+++ /dev/null
@@ -1,12 +0,0 @@
-import { METADATA } from '../constants';
-import { titleCase } from './text';
-
-// DELETE THIS FILE WHEN DONE
-
-export function generateTitle(prefix: string) {
- return prefix ? `${titleCase(prefix)} - ${METADATA.TITLE}` : METADATA.TITLE;
-}
-
-export function generateURL(prefix: string) {
- return prefix ? `${METADATA.HOST_URL}${prefix}` : METADATA.HOST_URL;
-}