Skip to content

Commit

Permalink
Fix: meta
Browse files Browse the repository at this point in the history
  • Loading branch information
luciobenini committed Jun 28, 2022
1 parent ddeb5f0 commit b0622b9
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 12 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@pittica/gatsby-plugin-seo",
"private": false,
"description": "SEO optimization plugin for GatsbyJS.",
"version": "4.3.6",
"version": "4.3.7",
"author": {
"name": "Lucio Benini",
"email": "[email protected]",
Expand Down
32 changes: 22 additions & 10 deletions src/components/page-meta.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,28 @@ import PropTypes from "prop-types"
import { withUrl } from "@pittica/gatsby-plugin-utils"

export default function PageMeta({ siteUrl, description, image }) {
return (
<Helmet>
{description && (
<meta name="description" content={description} key="html-description" />
)}
{image && (
<meta name="image" content={withUrl(image, siteUrl)} key="html-image" />
)}
</Helmet>
)
if (description || image) {
return (
<Helmet>
{description && (
<meta
name="description"
content={description}
key="html-description"
/>
)}
{image && (
<meta
name="image"
content={withUrl(image, siteUrl)}
key="html-image"
/>
)}
</Helmet>
)
} else {
return null
}
}

PageMeta.propTypes = {
Expand Down
2 changes: 1 addition & 1 deletion src/gatsby-browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export function wrapPageElement(
/>
<Links
siteUrl={siteUrl}
path={location.href || withUrl(location.pathname, siteUrl)}
path={location.href || location.pathname}
next={searchArray(fields.next, data)}
previous={searchArray(fields.previous, data)}
/>
Expand Down

0 comments on commit b0622b9

Please sign in to comment.