Skip to content

Commit 8055792

Browse files
committed
Add SEO and rename cancer to lymphoma.
1 parent 4be2972 commit 8055792

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+345
-174
lines changed

gatsby-config.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@
22
module.exports = {
33
siteMetadata: {
44
siteUrl: `https://www.mariuzzo.com`,
5-
title: `Mariuzzo`
5+
title: `Mariuzzo`,
6+
description: `Experience on programming and lymphoma.`,
7+
keywords: [`Code`, `Lymphoma`, `Blog`, `Rubens`, `Mariuzzo`],
8+
author: `Rubens Mariuzzo`
69
},
710
plugins: [
811
{ resolve: `gatsby-plugin-typescript` },

package-lock.json

Lines changed: 30 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,12 @@
3434
"normalize.css": "^8.0.1",
3535
"react": "^17.0.2",
3636
"react-dom": "^17.0.2",
37+
"react-helmet": "^6.1.0",
3738
"styled-breakpoints": "^10.0.1"
3839
},
3940
"devDependencies": {
4041
"@types/inquirer": "^7.3.3",
42+
"@types/react-helmet": "^6.1.2",
4143
"@types/styled-components": "^5.1.12",
4244
"babel-plugin-styled-components": "^1.13.2",
4345
"gatsby-cli": "^3.12.0",

scripts/new-post.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ async function newPost() {
2222
type: 'list',
2323
name: 'postType',
2424
choices: [
25-
{ name: 'Cancer', value: 'cancer' },
25+
{ name: 'Lymphoma', value: 'lymphoma' },
2626
{ name: 'Code', value: 'code' }
2727
]
2828
})

src/components/Header.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export const Header = () => {
1919
<S.NavMenuLink to="/code">Code</S.NavMenuLink>
2020
</S.NavMenuItem>
2121
<S.NavMenuItem>
22-
<S.NavMenuLink to="/cancer">Cancer</S.NavMenuLink>
22+
<S.NavMenuLink to="/lymphoma">Lymphoma</S.NavMenuLink>
2323
</S.NavMenuItem>
2424
<S.NavMenuItem>
2525
<S.NavMenuLink to="/about">About</S.NavMenuLink>

src/components/SEO.tsx

Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
import * as React from 'react'
2+
import { Helmet } from 'react-helmet'
3+
import { useStaticQuery, graphql } from 'gatsby'
4+
5+
type SEOProps = {
6+
title: string
7+
description?: string
8+
lang?: string
9+
meta?: Array<{
10+
name?: string
11+
content?: string
12+
property?: string
13+
}>
14+
image?: {
15+
src: string
16+
height: number
17+
width: number
18+
}
19+
pathname?: string
20+
}
21+
22+
export const SEO: React.FC<SEOProps> = ({
23+
description,
24+
lang,
25+
meta,
26+
image,
27+
title,
28+
pathname
29+
}) => {
30+
const { site } = useStaticQuery(
31+
graphql`
32+
query {
33+
site {
34+
siteMetadata {
35+
title
36+
description
37+
author
38+
keywords
39+
siteUrl
40+
}
41+
}
42+
}
43+
`
44+
)
45+
46+
const metaDescription = description || site.siteMetadata.description
47+
const metaImage =
48+
image && image.src ? `${site.siteMetadata.siteUrl}${image.src}` : null
49+
const canonical = pathname ? `${site.siteMetadata.siteUrl}${pathname}` : null
50+
51+
return (
52+
<Helmet
53+
htmlAttributes={{
54+
lang
55+
}}
56+
title={title}
57+
titleTemplate={`%s | ${site.siteMetadata.title}`}
58+
link={
59+
canonical
60+
? [
61+
{
62+
rel: 'canonical',
63+
href: canonical
64+
}
65+
]
66+
: []
67+
}
68+
meta={[
69+
{
70+
name: `description`,
71+
content: metaDescription
72+
},
73+
{
74+
name: 'keywords',
75+
content: site.siteMetadata.keywords.join(',')
76+
},
77+
{
78+
property: `og:title`,
79+
content: title
80+
},
81+
{
82+
property: `og:description`,
83+
content: metaDescription
84+
},
85+
{
86+
property: `og:type`,
87+
content: `website`
88+
},
89+
{
90+
name: `twitter:creator`,
91+
content: site.siteMetadata.author
92+
},
93+
{
94+
name: `twitter:title`,
95+
content: title
96+
},
97+
{
98+
name: `twitter:description`,
99+
content: metaDescription
100+
}
101+
]
102+
.concat(
103+
image
104+
? [
105+
{
106+
property: 'og:image',
107+
content: metaImage
108+
},
109+
{
110+
property: 'og:image:width',
111+
content: image.width
112+
},
113+
{
114+
property: 'og:image:height',
115+
content: image.height
116+
},
117+
{
118+
name: 'twitter:card',
119+
content: 'summary_large_image'
120+
}
121+
]
122+
: [
123+
{
124+
name: 'twitter:card',
125+
content: 'summary'
126+
}
127+
]
128+
)
129+
.concat(meta as any)}
130+
/>
131+
)
132+
}
133+
134+
SEO.defaultProps = {
135+
lang: `en`,
136+
meta: [],
137+
description: ``,
138+
image: {
139+
src: '/images/icon.png',
140+
height: 1040,
141+
width: 1040
142+
}
143+
}

src/html.tsx

Lines changed: 0 additions & 38 deletions
This file was deleted.

src/layouts/PostLayout.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { formatRFC7231 } from 'date-fns'
33

44
import * as S from './PostLayout.styles'
55
import { MainLayout } from './MainLayout'
6+
import { SEO } from '../components/SEO'
67

78
type PostLayoutProps = {
89
title: string
@@ -24,6 +25,7 @@ export const PostLayout: React.FC<PostLayoutProps> = ({
2425
}) => {
2526
return (
2627
<MainLayout {...more}>
28+
<SEO title={title} />
2729
<S.Container>
2830
<S.PostCategory>{category}</S.PostCategory>
2931
<S.PostTitle>{title}</S.PostTitle>

src/markdown/cancer/2015-09-01.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
---
22
date: 2015-09-01T04:00:00.000
33
title: A small ball
4-
slug: /cancer/2015-09-01
4+
slug: /lymphoma/2015-09-01
55
---
66

7-
![A small ball](/images/cancer/o5yk4f03BA1vsn3evo1.jpg)
7+
![A small ball](/images/lymphoma/o5yk4f03BA1vsn3evo1.jpg)
88

99
Someday, at night, I felt a **“small ball”** in the right side of my neck. While examining it, I was thinking on what could it be. Mosquitos? Unknown insects? Since it was something I could only perceive by touch, not visible, I decided to let it go and check daily from that day.

src/markdown/cancer/2016-03-03.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
---
22
date: 2016-03-03T05:00:00.000
33
title: Otorhinolaryngologist appointment
4-
slug: /cancer/2016-03-03
4+
slug: /lymphoma/2016-03-03
55
---
66

7-
![Painting](/images/cancer/o5ymwnF9au1vsn3evo1.jpg)
7+
![Painting](/images/lymphoma/o5ymwnF9au1vsn3evo1.jpg)
88

99
Today, I went to the doctor (an otorhinolaryngologist) and I brought to her the results of my lymph node biopsy. The results says it could be a **lymphoma**.
1010

0 commit comments

Comments
 (0)