From f4955f77c1be047b75634139075170a94dcd85b1 Mon Sep 17 00:00:00 2001 From: Hippo Date: Mon, 23 Sep 2019 17:30:03 +0530 Subject: [PATCH] Add author credits to end of post --- src/templates/post.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/templates/post.js b/src/templates/post.js index ae0bc0c..6f5c914 100755 --- a/src/templates/post.js +++ b/src/templates/post.js @@ -1,6 +1,7 @@ import React from 'react' import PropTypes from 'prop-types' import { graphql } from 'gatsby' +import { Link } from 'gatsby' import Helmet from 'react-helmet' import { Layout } from '../components/common' @@ -40,6 +41,15 @@ const Post = ({ data, location }) => { className="content-body load-external-scripts" dangerouslySetInnerHTML={{ __html: post.html }} /> +
+

+ Written by { post.authors.map((author, key) => ([ + { author.name }, + { key == post.authors.length-1 ? '' : + key == post.authors.length-2 ? ' and ' : ', ' } + ]))} +

+