diff --git a/client/gatsby-ssr.js b/client/gatsby-ssr.js
index 91a115123c..041dda0934 100644
--- a/client/gatsby-ssr.js
+++ b/client/gatsby-ssr.js
@@ -4,10 +4,9 @@ import { Provider } from 'react-redux';
import { I18nextProvider } from 'react-i18next';
import i18n from './i18n/config';
-import headComponents from './src/head';
import { createStore } from './src/redux/createStore';
-
import layoutSelector from './utils/gatsby/layoutSelector';
+import { getheadTagComponents, getPostBodyComponents } from './utils/tags';
const store = createStore();
@@ -23,26 +22,6 @@ wrapRootElement.propTypes = {
element: PropTypes.any
};
-// TODO: put these in a common utils file.
-const mathJaxCdn = {
- address:
- 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/' +
- '2.7.4/MathJax.js?config=TeX-AMS_HTML',
- id: 'mathjax',
- key: 'mathjax',
- type: 'text/javascript'
-};
-
-const stripeScript = {
- address: 'https://js.stripe.com/v3/',
- id: 'stripe-js',
- key: 'stripe-js',
- type: 'text/javascript'
-};
-
-const challengeRE = new RegExp('/learn/[^/]+/[^/]+/[^/]+/?$');
-const donateRE = new RegExp('/donate/?$');
-
export const wrapPageElement = layoutSelector;
export const onRenderBody = ({
@@ -50,52 +29,6 @@ export const onRenderBody = ({
setHeadComponents,
setPostBodyComponents
}) => {
- setHeadComponents([...headComponents]);
- const scripts = [
- ,
-
- ];
-
- if (
- pathname.includes('/learn/coding-interview-prep/rosetta-code') ||
- pathname.includes('/learn/coding-interview-prep/project-euler')
- ) {
- scripts.push(
-
- );
- }
-
- if (challengeRE.test(pathname) || donateRE.test(pathname)) {
- scripts.push(
-
- );
- }
-
- setPostBodyComponents(scripts.filter(Boolean));
+ setHeadComponents(getheadTagComponents());
+ setPostBodyComponents(getPostBodyComponents(pathname));
};
diff --git a/client/i18n/locales/chinese/translations.json b/client/i18n/locales/chinese/translations.json
index b7053f0a69..427e0ed4ca 100644
--- a/client/i18n/locales/chinese/translations.json
+++ b/client/i18n/locales/chinese/translations.json
@@ -2,6 +2,7 @@
"meta": {
"title": "免费学习编程 – 适合忙碌人士的编程课程",
"description": "在家学习编程,构建项目,获得认证。自 2014 年以来,已有超过 40,000 名 freeCodeCamp 学员入职谷歌、苹果、亚马逊、微软等科技公司。",
+ "social-description": "Learn to Code — For Free",
"keywords": [
"javascript",
"js",
diff --git a/client/i18n/locales/english/translations.json b/client/i18n/locales/english/translations.json
index bfe9c772f9..6003040630 100644
--- a/client/i18n/locales/english/translations.json
+++ b/client/i18n/locales/english/translations.json
@@ -1,7 +1,8 @@
{
"meta": {
"title": "Learn to Code — For Free — Coding Courses for Busy People",
- "description": "Learn to code — for free.",
+ "description": "Learn to Code — For Free",
+ "social-description": "Learn to Code — For Free",
"keywords": [
"javascript",
"js",
diff --git a/client/i18n/locales/espanol/translations.json b/client/i18n/locales/espanol/translations.json
index 28d3fe5081..c8846a07b2 100644
--- a/client/i18n/locales/espanol/translations.json
+++ b/client/i18n/locales/espanol/translations.json
@@ -2,6 +2,7 @@
"meta": {
"title": "Aprende a codificar gratis: cursos de programación para personas ocupadas",
"description": "Aprende a codificar en casa. Construye proyectos. Obtén certificaciones. Desde el 2014, más de 40,000 graduados de freeCodeCamp.org han conseguido trabajos en empresas de tecnología como Google, Apple, Amazon y Microsoft.",
+ "social-description": "Learn to Code — For Free",
"keywords": [
"javascript",
"js",
diff --git a/client/i18n/translations-schema.js b/client/i18n/translations-schema.js
index c17cc56827..e4ea14b1ad 100644
--- a/client/i18n/translations-schema.js
+++ b/client/i18n/translations-schema.js
@@ -4,9 +4,9 @@
*/
const translationsSchema = {
meta: {
- title: 'Learn to Code for Free – Coding Courses for Busy People',
- description:
- 'Learn to code at home. Build projects. Earn certifications. Since 2014, more than 40,000 freeCodeCamp.org graduates have gotten jobs at tech companies including Google, Apple, Amazon, and Microsoft.',
+ title: 'Learn to Code — For Free — Coding Courses for Busy People',
+ description: 'Learn to Code — For Free',
+ 'social-description': 'Learn to Code — For Free',
keywords: [
'javascript',
'js',
diff --git a/client/src/head/index.js b/client/src/head/index.js
deleted file mode 100644
index 70d90294bc..0000000000
--- a/client/src/head/index.js
+++ /dev/null
@@ -1,9 +0,0 @@
-import meta from './meta';
-
-const metaAndStyleSheets = meta.map((element, i) => ({
- ...element,
- key: `meta-stylesheet-${i}`,
- props: { ...element.props, key: `meta-stylesheet-${i}` }
-}));
-
-export default metaAndStyleSheets;
diff --git a/client/src/head/meta.js b/client/src/head/meta.js
deleted file mode 100644
index c870deea7e..0000000000
--- a/client/src/head/meta.js
+++ /dev/null
@@ -1,34 +0,0 @@
-import React from 'react';
-
-const meta = [
- ,
- ,
- ,
- ,
- ,
- ,
- ,
-
-];
-
-export default meta;
diff --git a/client/src/head/preloads.js b/client/src/head/preloads.js
deleted file mode 100644
index c38f582a4f..0000000000
--- a/client/src/head/preloads.js
+++ /dev/null
@@ -1,11 +0,0 @@
-import React from 'react';
-import styleSheets from './styleSheets';
-
-const preloads = styleSheets.map(styleSheet => (
-