I am currently creating share buttons with Gatsby and would like to share content based on the current url, which changes depending on the environment and the current page. With GoHugo this can be called with {{ .Permalink }}
. Does anyone know how to do this with Gatsby?
I have a ShareButtons component, which is a child of BlogPostTemplate.
Gatsby uses react-router behind the scene meaning location information is available in props. This information can be used in a conditional statement or passed into styled-components like so:
<Component isIndex={this.props.location.pathname === '/'}>