From 31cc2b8311290759c43d1b5cda4f40b2326c2e87 Mon Sep 17 00:00:00 2001 From: Jason Lengstorf Date: Fri, 11 Jan 2019 10:11:00 +0100 Subject: [PATCH] fix: product page SEO and captions - use product info and image for SEO tags on product pages - fix lorem ipsum text in captions --- .../ProductPage/CommunityCaption.js | 21 +++++++--- src/templates/ProductPageTemplate.js | 40 ++++++++++++++++++- 2 files changed, 54 insertions(+), 7 deletions(-) diff --git a/src/components/ProductPage/CommunityCaption.js b/src/components/ProductPage/CommunityCaption.js index 450a9e8c..91b78c22 100644 --- a/src/components/ProductPage/CommunityCaption.js +++ b/src/components/ProductPage/CommunityCaption.js @@ -96,6 +96,10 @@ const UserPhotoHint = styled(`div`)` display: none; } } + + a { + color: inherit; + } `; class CommunityCaption extends Component { @@ -115,10 +119,12 @@ class CommunityCaption extends Component { }; toggleIncentive = e => { - e.preventDefault(); - e.stopPropagation(); + if (!e.target.href) { + e.preventDefault(); + e.stopPropagation(); - this.setState(state => ({ hintExpanded: !state.hintExpanded })); + this.setState(state => ({ hintExpanded: !state.hintExpanded })); + } }; render() { @@ -141,11 +147,14 @@ class CommunityCaption extends Component { onClick={this.toggleIncentive} className={hintExpanded ? 'expanded' : ''} > - Would you like to see a photo of your pet here?{' '} + We want to see your Gatsby swag photos!{' '} Read more... - Contrary to popular belief, Lorem Ipsum is not simply random text. - It has roots in a piece of classical Latin. + Upload your photos to{' '} + + the official photo sharing issue + {' '} + and it may be featured in the store! diff --git a/src/templates/ProductPageTemplate.js b/src/templates/ProductPageTemplate.js index c6661070..5a249b97 100644 --- a/src/templates/ProductPageTemplate.js +++ b/src/templates/ProductPageTemplate.js @@ -5,12 +5,19 @@ import Helmet from 'react-helmet'; import InterfaceContext from '../context/InterfaceContext'; import ProductPage from '../components/ProductPage'; +const removeCareInstructions = desc => + desc.split(/Care Instructions/).slice(0, 1); + const ProductPageTemplate = props => { const { + site, shopifyProduct: product, - shopifyProduct: { title } + shopifyProduct: { title, description: fullDescription, handle } } = props.data; + const description = removeCareInstructions(fullDescription); + const image = product.images[0].localFile.childImageSharp.fluid.src; + return ( {({ @@ -23,6 +30,29 @@ const ProductPageTemplate = props => { <> {title} + + + + + + + + + + {/* TODO: add the image */} + + + + + + +