Skip to content

Commit 5b9b613

Browse files
committed
🧹
1 parent ba32b4c commit 5b9b613

4 files changed

Lines changed: 90 additions & 18 deletions

File tree

gatsby-node.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,13 @@ exports.createPages = async ({ graphql, actions }) => {
4444
}
4545
frontmatter {
4646
title
47+
meta_desc
48+
canonical
49+
keywords
50+
social_share_summary
51+
social_share_desc
52+
social_share_image
53+
noindex
4754
}
4855
}
4956
}

src/components/seo.jsx

Lines changed: 56 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,17 @@ import Helmet from 'react-helmet';
1111
import { useStaticQuery, graphql } from 'gatsby';
1212
import favicon from './../images/favicon-new.ico';
1313

14-
function SEO({
15-
lang, meta, title, slug,
14+
function SEO({ lang,
15+
meta,
16+
title,
17+
slug,
18+
canonical,
19+
meta_desc,
20+
keywords,
21+
social_share_summary,
22+
social_share_desc,
23+
social_share_image,
24+
noindex
1625
}) {
1726
const { site } = useStaticQuery(
1827
graphql`
@@ -28,6 +37,8 @@ function SEO({
2837
`,
2938
);
3039

40+
const isIndexed = !noindex ? 'index, follow' : 'noindex, nofollow'
41+
3142
return (
3243
<Helmet
3344
htmlAttributes={{
@@ -37,53 +48,73 @@ function SEO({
3748
titleTemplate={`%s | ${site.siteMetadata.title}`}
3849
meta={[
3950
{
40-
name: 'google-site-verification',
41-
content: '58TM3lGyGn6c2Bj0PvPQSNzrd9_yBsHs2BjJ6KMHlRU',
51+
name: 'description',
52+
content: meta_desc
4253
},
4354
{
44-
property: 'og:url',
45-
content: 'https://testsigma.com/docs/',
55+
name: 'keywords',
56+
content: keywords
57+
},
58+
{
59+
name: 'google-site-verification',
60+
content: '58TM3lGyGn6c2Bj0PvPQSNzrd9_yBsHs2BjJ6KMHlRU',
4661
},
4762
{
4863
property: 'og:title',
49-
content: title,
64+
content: title
5065
},
5166
{
52-
property: 'og:site_name',
53-
content: 'Testsigma Docs',
67+
property: 'og:description',
68+
content: social_share_desc
5469
},
5570
{
5671
property: 'og:image',
57-
content: 'https://website-static.testsigma.com/assets/home/homepage-linkedin.png',
72+
content: social_share_image
73+
},
74+
{
75+
property: 'og:url',
76+
content: `https://testsigma.com${slug}`,
5877
},
5978
{
6079
property: 'og:type',
6180
content: 'website',
6281
},
6382
{
64-
name: 'twitter:card',
65-
content: 'summary',
83+
property: 'og:site_name',
84+
content: 'Testsigma Docs',
6685
},
6786
{
6887
name: 'twitter:creator',
6988
content: site.siteMetadata.author,
7089
},
90+
{
91+
name: 'twitter:card',
92+
content: social_share_summary
93+
},
7194
{
7295
name: 'twitter:title',
7396
content: title,
7497
},
7598
{
76-
property: 'twitter:domain',
77-
content: 'https://testsigma.com/docs/',
99+
property: 'twitter:description',
100+
content: social_share_desc
78101
},
79102
{
80-
property: 'og:image',
81-
content: 'https://website-static.testsigma.com/assets/home/homepage-linkedin.png',
103+
property: 'twitter:image',
104+
content: social_share_image
105+
},
106+
{
107+
property: 'twitter:domain',
108+
content: `https://testsigma.com${slug}`
82109
},
83110
{
84111
property: 'twitter:site',
85112
content: '@testsigmainc',
86113
},
114+
{
115+
name: 'robots',
116+
content: isIndexed
117+
},
87118
].concat(meta)}
88119
>
89120
{/* fav icon */}
@@ -100,7 +131,8 @@ function SEO({
100131
{/* <link rel="dns-prefetch" href="https://stackpath.bootstrapcdn.com" /> */}
101132
{/* <link crossOrigin rel="preconnect" href="https://stackpath.bootstrapcdn.com" /> */}
102133
{/* <link href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossOrigin="anonymous" /> */}
103-
<link rel="canonical" href={`https://testsigma.com${slug}`} />
134+
{/* canonical */}
135+
{ canonical ? <link rel="canonical" href={canonical} /> : <link rel="canonical" href={`https://testsigma.com${slug}`} />}
104136
{/* Algolia Instantsearch IE11 support v3 */}
105137
{/* <script src="https://polyfill.io/v3/polyfill.min.js?features=default,Array.prototype.find,Array.prototype.includes" /> */}
106138
{/* */}
@@ -124,6 +156,13 @@ SEO.propTypes = {
124156
lang: PropTypes.string,
125157
meta: PropTypes.arrayOf(PropTypes.object),
126158
title: PropTypes.string.isRequired,
159+
canonical: PropTypes.string,
160+
meta_desc: PropTypes.string,
161+
keywords: PropTypes.string,
162+
social_share_summary: PropTypes.string,
163+
social_share_desc: PropTypes.string,
164+
social_share_image: PropTypes.string,
165+
noindex: PropTypes.bool
127166
};
128167

129168
export default SEO;

src/pages/tutorials/getting-started/automate-web-applications.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@ order: 1.1
44
page_id: "Get Started with Automating Web Applications"
55
search_keyword: "Get started, Automate Web Applications, Testsigma Tutorials"
66
warning: false
7+
canonical: "page url"
8+
page_title: "Get Started with Automating Web Applications"
9+
meta_desc: ""
10+
social_share_summary: "Twitter summary message"
11+
social_share_desc: "Sharing page description"
12+
social_share_image: "Sharing page thumbnail image url"
13+
keywords: ""
14+
noindex: true
715
contextual_links:
816
- type: section
917
name: "Contents"

src/templates/page.jsx

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,17 @@ export default ({ data, pageContext }) => {
3737

3838
return (
3939
<Layout>
40+
<SEO
41+
title={post.frontmatter.page_title || post.frontmatter.title}
42+
slug={post.fields.slug}
43+
canonical={post.frontmatter.canonical}
44+
meta_desc={post.frontmatter.meta_desc}
45+
keywords={post.frontmatter.keywords}
46+
social_share_summary={post.frontmatter.social_share_summary}
47+
social_share_desc={post.frontmatter.social_share_desc}
48+
social_share_image={post.frontmatter.social_share_image}
49+
noindex={post.frontmatter.noindex || true}
50+
/>
4051
<header>
4152
<div className="flex items-stretch">
4253
<nav className="lex max-w-sm w-1/4">
@@ -81,7 +92,6 @@ export default ({ data, pageContext }) => {
8192
</div>
8293
</header>
8394
<hr/>
84-
<SEO title={post.frontmatter.title} slug={post.fields.slug} />
8595
{/*<SubNav></SubNav>*/}
8696
<div className="w-full">
8797
<div className="flex items-stretch">
@@ -162,6 +172,14 @@ export const query = graphql`
162172
html
163173
frontmatter {
164174
title
175+
page_title
176+
meta_desc
177+
canonical
178+
keywords
179+
social_share_summary
180+
social_share_desc
181+
social_share_image
182+
noindex
165183
contextual_links {
166184
type
167185
name

0 commit comments

Comments
 (0)