WIP, psts in place, parsing mostly correclty

This commit is contained in:
2020-09-21 21:56:11 -05:00
parent 8de94aa769
commit d274352b5f
87 changed files with 4820 additions and 11 deletions

13
src/templates/page.js Normal file
View File

@@ -0,0 +1,13 @@
import React from "react";
import Layout from "../components/layout"
export default function Page({ children }) {
return (
<Layout>
<article class="page">
<h1 class="page-title">page.title</h1>
{children}
</article>
</Layout>
);
}

71
src/templates/post.js Normal file
View File

@@ -0,0 +1,71 @@
import React from "react";
import { graphql } from "gatsby";
import Layout from "../components/layout";
import { DiscussionEmbed } from 'disqus-react';
export default function Post({ data }) {
const post = data.markdownRemark;
var tags = post.frontmatter.tags.map((tag) => {
return (<a href={'/tags/' + tag }>#{tag}</a>);
});
var categories = post.frontmatter.categories.map((category) => {
return (<a href={'/categories/' + category }>#{category}</a>);
});
var postDate = new Date(post.frontmatter.date);
console.log(postDate);
var isoDate = postDate.toISOString();
var visibleDate = postDate.toDateString();
return (
<Layout>
<div>
<article className="post">
<h1 className="post-title">{post.frontmatter.title}</h1>
<div className="post-info d-flex justify-content-start">
<time datetime={isoDate} className="post-date">{visibleDate}</time>
<nav className="post-tags">
{tags}
</nav>
<nav className="post-categories">
<span>posted in:</span>
{categories}
</nav>
</div>
<div dangerouslySetInnerHTML={{ __html: post.html }} />
</article>
<DiscussionEmbed
shortname='fishybusiness'
config={
{
url: "https://" + data.site.host + ":" + data.site.port,
identifier: post.slug,
title: post.frontmatter.title,
language: 'en_US'
}
}/>
</div>
</Layout>
)
}
export const query = graphql`
query($slug: String!) {
markdownRemark(fields: { slug: { eq: $slug } }) {
html
frontmatter {
title
date
categories
tags
}
}
site {
host
port
}
}
`