sana137.in

Sana's gatsbyjs-based blog
git clone http://git.hanabi.in/repos/sana137.in.git
Log | Files | Refs | README | LICENSE

commit 2a280fd0a88384bb1c9c297e6b3528ea5f8353dd
parent f4b43ff55bc42dbeddee9a16ecb174ca668d6eb9
Author: cognitive137 <36829952+cognitive137@users.noreply.github.com>
Date:   Fri, 13 Sep 2019 21:39:33 +0530

Update component name, add option for bgImg for tags
Diffstat:
Msrc/templates/singleTagIndex.js | 11+++++++----
1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/src/templates/singleTagIndex.js b/src/templates/singleTagIndex.js @@ -3,16 +3,19 @@ import { Link } from 'gatsby'; import ComplexHeader from '../components/complexHeader'; import Footer from '../components/footer'; -const AllTagsTemplate = ({ data, pageContext }) => { - const { posts, tag } = pageContext; +const SingleTagTemplate = ({ pageContext }) => { + const { cover, posts, tag } = pageContext; + /* eslint eqeqeq: "off" */ + const bgImg = cover.length == 1 ? cover[0].cover : ''; const desc = `Essay${posts.length > 1 ? 's' : ''} about ${tag}.`; return ( - <div className={'tag-template tag-movie-reviews'}> + <div className={'tag-template'}> <div className={'site-wrapper'}> <ComplexHeader siteTitle={tag.toUpperCase()} description={desc} hideName={true} + headerImg={bgImg} /> <main id={'site-main'} className={'site-main outer'}> <div className={'inner'}> @@ -63,4 +66,4 @@ const AllTagsTemplate = ({ data, pageContext }) => { ); }; -export default AllTagsTemplate; +export default SingleTagTemplate;