Skip to content

Commit

Permalink
add react helmet meta tag
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobo-martinez committed Dec 30, 2019
1 parent 52d701e commit a840719
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 11 deletions.
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ module.exports = {
'react/jsx-filename-extension': 'off', // disable if necessary
'react/static-property-placement': 'off', // disable if necessary
'react/jsx-props-no-spreading': 'off', // disable if necessary
'react/require-default-props': 'off',
},
parser: 'babel-eslint',
};
6 changes: 3 additions & 3 deletions src/components/Image/AboutImg.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ const AboutImg = ({ filename, alt }) => (
if (!image) return null;

const imageFixed = image.node.childImageSharp.fixed;
return <Img className="img-fluid rounded shadow-lg" alt={alt} fixed={imageFixed} />;
return <Img alt={alt} fixed={imageFixed} />;
}}
/>
);

AboutImg.propTypes = {
filename: PropTypes.string.isRequired,
alt: PropTypes.string.isRequired,
filename: PropTypes.string,
alt: PropTypes.string,
};

export default AboutImg;
4 changes: 2 additions & 2 deletions src/components/Image/ProjectImg.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ const ProjectImg = ({ filename, alt }) => (
);

ProjectImg.propTypes = {
filename: PropTypes.string.isRequired,
alt: PropTypes.string.isRequired,
filename: PropTypes.string,
alt: PropTypes.string,
};

export default ProjectImg;
7 changes: 7 additions & 0 deletions src/mock/data.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
import uuidv1 from 'uuid/v1';

// HEAD DATA
export const headData = {
title: 'Jacobo | Developer',
lang: 'en', // e.g: en, es, fr, jp
domain: 'https://cobidev.com/',
};

// HERO DATA
export const heroData = {
title: '',
Expand Down
23 changes: 17 additions & 6 deletions src/pages/index.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,22 @@
import React from 'react';
import { Helmet } from 'react-helmet';
import App from '../components/App';
import { PortfolioProvider } from '../context/context';
import { headData } from '../mock/data';
import 'bootstrap/dist/css/bootstrap.min.css';
import '../style/main.scss';

export default () => (
<PortfolioProvider>
<App />
</PortfolioProvider>
);
export default () => {
const { title, lang } = headData;

return (
<>
<Helmet>
<meta charSet="utf-8" />
<title>{title || 'Gatsby Simplefolio'}</title>
<html lang={lang || 'en'} />
{/* <link rel="canonical" href="http://mysite.com/example" /> */}
</Helmet>
<App />
</>
);
};

0 comments on commit a840719

Please sign in to comment.