View gatsby-plugin-canonical.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
plugins: [ | |
`gatsby-plugin-react-helmet`, | |
{ | |
resolve: `gatsby-plugin-react-helmet-canonical-urls`, | |
options: { | |
siteUrl: `https://www.example.com`, | |
}, | |
}, | |
] |
View gatsby-plugin-seo-example2.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { FC } from 'react'; | |
import { GatsbySeo } from 'gatsby-plugin-next-seo'; | |
const Layout: FC = ({ children }) => ( | |
<> | |
<GatsbySeo | |
title='Using More of Config' | |
description='This example uses more of the available config options.' | |
openGraph={{ | |
url: 'https://www.example.com/somepage', |
View gatsby-plugin-seo-example.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import { GatsbySeo } from 'gatsby-plugin-next-seo'; | |
export default () => ( | |
<> | |
<GatsbySeo | |
title='Simple Usage Example' | |
description='A short description goes here.' | |
language='en' | |
/> |
View gatsby-plugin-robots-txt.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
plugins: [ | |
{ | |
resolve: 'gatsby-plugin-robots-txt', | |
options: { | |
host: '<https://www.example.com>', | |
sitemap: '<https://www.example.com/sitemap.xml>', | |
policy: [{ userAgent: '*', allow: '/' }] | |
} | |
} | |
] |
View gatsby-plugin-react-helmet.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
plugins: [ | |
{ | |
resolve: 'gatsby-plugin-robots-txt', | |
options: { | |
host: '<https://www.example.com>', | |
sitemap: '<https://www.example.com/sitemap.xml>', | |
policy: [{ userAgent: '*', allow: '/' }] | |
} | |
} | |
] |
View gatsby-plugin-sitemap.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
query: ` | |
{ | |
wp { | |
generalSettings { | |
siteUrl | |
} | |
} | |
allSitePage { | |
nodes { | |
path |
View split-join.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function removeFromText(text, strToBeRemoved) { | |
return text.split(strToBeRemoved).join(''); | |
} | |
removeFromText('lorem+ipsum+dolor+sit+amet', '+'); | |
// -> 'loremipsumdolorsitamet' ✅ |
View replace-several-examples.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
removeFromText('lorem ipsum dolor sit amet', ' '); | |
// -> 'loremipsumdolorsitamet' ✅ works | |
removeFromText('lorem+ipsum+dolor+sit+amet', '+'); | |
// -> throws error ❌ | |
removeFromText('lorem+ipsum+dolor+sit+amet', '+'); | |
// -> still throws error ❌ | |
removeFromText('lorem+ipsum+dolor+sit+amet', '\\+'); |
View regexp-g.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function removeFromText(text, strToBeRemoved) { | |
return text.replace(new RegExp(strToBeRemoved, 'g'), ''); | |
} |
View replace-regex.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'lorem ipsum dolor sit amet'.replace(/ /g, '-'); | |
// -> 'lorem-ipsum-dolor-sit-amet |
NewerOlder