From b0136b930c0a1ede9090dc6cbbb37de71423a1b3 Mon Sep 17 00:00:00 2001 From: Ivan Shcheklein Date: Mon, 18 Nov 2019 17:28:17 -0800 Subject: [PATCH 1/3] generalize, review and fix meta fields --- consts/index.js | 9 ++++++++ pages/_document.js | 37 ++++++++++++------------------- pages/features.js | 3 ++- pages/index.js | 3 ++- pages/support.js | 3 ++- src/Documentation/HeadInjector.js | 8 +++++-- 6 files changed, 35 insertions(+), 28 deletions(-) diff --git a/consts/index.js b/consts/index.js index d58950b582..2005763cc1 100644 --- a/consts/index.js +++ b/consts/index.js @@ -1 +1,10 @@ export const HEADER = 'header' + +export const META_BASE_TITLE = 'Data Version Control · DVC' +export const META_DESCRIPTION = + 'Open-source version control system for Data Science and Machine Learning ' + + 'projects. Git-like experience to organize your data, models, and ' + + 'experiments.' +export const META_KEYWORDS = + 'data version control machine learning models management' +export const META_SOCIAL_IMAGE = 'https://dvc.org/static/social-share.png' diff --git a/pages/_document.js b/pages/_document.js index f94e8ee934..f73dab1cdd 100644 --- a/pages/_document.js +++ b/pages/_document.js @@ -1,11 +1,12 @@ import React from 'react' import Document, { Head, Main, NextScript } from 'next/document' import { ServerStyleSheet } from 'styled-components' - -const DESCRIPTION = - `Open-source version control system for Data Science and Machine Learning ` + - `projects. Track your data, models, and experiments with a Git-like tool.` -const KEYWORDS = `data version control machine learning models management` +import { + META_BASE_TITLE, + META_DESCRIPTION, + META_KEYWORDS, + META_SOCIAL_IMAGE +} from '../consts' const inject = str => (
@@ -27,41 +28,31 @@ export default class Page extends Document { - - + + - - + + - Machine Learning Version Control System · DVC + {META_BASE_TITLE} ) diff --git a/pages/support.js b/pages/support.js index 1eab32e374..b2a39ec0ec 100644 --- a/pages/support.js +++ b/pages/support.js @@ -11,10 +11,11 @@ import Page from '../src/Page' import Hero from '../src/Hero' import TrySection from '../src/TrySection' import Popover from '../src/Popover/Popover' +import { META_BASE_TITLE } from '../consts' const HeadInjector = () => ( - Support | Machine Learning Version Control System + Support | {{ META_BASE_TITLE }} ) diff --git a/src/Documentation/HeadInjector.js b/src/Documentation/HeadInjector.js index 045d0964c5..33dd19a922 100644 --- a/src/Documentation/HeadInjector.js +++ b/src/Documentation/HeadInjector.js @@ -2,7 +2,9 @@ import Head from 'next/head' import PropTypes from 'prop-types' import React from 'react' -export const HeadInjector = () => ( +import { META_BASE_TITLE } from '../../consts' + +export const HeadInjector = ({ sectionName = 'Documentation' }) => ( ( type="text/javascript" src="https://cdn.jsdelivr.net/npm/docsearch.js@2.6.2/dist/cdn/docsearch.min.js" /> - Documentation | Machine Learning Version Control System · DVC + + {sectionName} | {META_BASE_TITLE} + ) From 18b22324e2a02a5fe774f0fb5b33a1d4493b62e2 Mon Sep 17 00:00:00 2001 From: Ivan Shcheklein Date: Mon, 18 Nov 2019 19:46:28 -0800 Subject: [PATCH 2/3] fix JSX expression in support head injector --- pages/support.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pages/support.js b/pages/support.js index b2a39ec0ec..19a31be769 100644 --- a/pages/support.js +++ b/pages/support.js @@ -15,7 +15,7 @@ import { META_BASE_TITLE } from '../consts' const HeadInjector = () => ( - Support | {{ META_BASE_TITLE }} + Support | {META_BASE_TITLE} ) From 690ec582e32a8f85e2e29528c63a9f3111bfd13d Mon Sep 17 00:00:00 2001 From: Ivan Shcheklein Date: Mon, 18 Nov 2019 19:55:19 -0800 Subject: [PATCH 3/3] move consts file like styles to src --- pages/_document.js | 2 +- pages/doc.js | 2 +- pages/features.js | 2 +- pages/index.js | 2 +- pages/support.js | 2 +- src/Documentation/HeadInjector.js | 2 +- src/Tooltip/desktop-view.js | 2 +- src/TopMenu/index.js | 2 +- consts/index.js => src/consts.js | 0 9 files changed, 8 insertions(+), 8 deletions(-) rename consts/index.js => src/consts.js (100%) diff --git a/pages/_document.js b/pages/_document.js index f73dab1cdd..e4c4865665 100644 --- a/pages/_document.js +++ b/pages/_document.js @@ -6,7 +6,7 @@ import { META_DESCRIPTION, META_KEYWORDS, META_SOCIAL_IMAGE -} from '../consts' +} from '../src/consts' const inject = str => (
diff --git a/pages/doc.js b/pages/doc.js index 8c3ad0904d..502afefbff 100644 --- a/pages/doc.js +++ b/pages/doc.js @@ -15,7 +15,7 @@ import RightPanel from '../src/Documentation/RightPanel/RightPanel' import fetch from 'isomorphic-fetch' import kebabCase from 'lodash.kebabcase' // constants -import { HEADER } from '../consts' +import { HEADER } from '../src/consts' // sidebar data and helpers import sidebar, { getItemByPath } from '../src/Documentation/SidebarMenu/helper' // styles diff --git a/pages/features.js b/pages/features.js index e1582a2e4c..3b7acbd94f 100644 --- a/pages/features.js +++ b/pages/features.js @@ -10,7 +10,7 @@ import Page from '../src/Page' import Hero from '../src/Hero' import FeaturesHero from '../src/FeaturesHero' import TrySection from '../src/TrySection' -import { META_BASE_TITLE } from '../consts' +import { META_BASE_TITLE } from '../src/consts' const HeadInjector = () => ( diff --git a/pages/index.js b/pages/index.js index 7cc58c3493..b62f04c6bb 100644 --- a/pages/index.js +++ b/pages/index.js @@ -11,7 +11,7 @@ import Diagram from '../src/Diagram' import PromoSection from '../src/PromoSection' import UseCases from '../src/UseCases' import Subscribe from '../src/Subscribe' -import { META_BASE_TITLE } from '../consts' +import { META_BASE_TITLE } from '../src/consts' const HeadInjector = () => ( diff --git a/pages/support.js b/pages/support.js index 19a31be769..09ca9b142c 100644 --- a/pages/support.js +++ b/pages/support.js @@ -11,7 +11,7 @@ import Page from '../src/Page' import Hero from '../src/Hero' import TrySection from '../src/TrySection' import Popover from '../src/Popover/Popover' -import { META_BASE_TITLE } from '../consts' +import { META_BASE_TITLE } from '../src/consts' const HeadInjector = () => ( diff --git a/src/Documentation/HeadInjector.js b/src/Documentation/HeadInjector.js index 33dd19a922..4a9b06c1d1 100644 --- a/src/Documentation/HeadInjector.js +++ b/src/Documentation/HeadInjector.js @@ -2,7 +2,7 @@ import Head from 'next/head' import PropTypes from 'prop-types' import React from 'react' -import { META_BASE_TITLE } from '../../consts' +import { META_BASE_TITLE } from '../consts' export const HeadInjector = ({ sectionName = 'Documentation' }) => ( diff --git a/src/Tooltip/desktop-view.js b/src/Tooltip/desktop-view.js index e2bd40e3f9..267287edc8 100644 --- a/src/Tooltip/desktop-view.js +++ b/src/Tooltip/desktop-view.js @@ -3,7 +3,7 @@ import PropTypes from 'prop-types' import ReactMarkdown from 'react-markdown' import styled from 'styled-components' -import { HEADER } from '../../consts' +import { HEADER } from '../consts' class DesktopView extends Component { state = { diff --git a/src/TopMenu/index.js b/src/TopMenu/index.js index d0661351b1..c3204dbfa0 100644 --- a/src/TopMenu/index.js +++ b/src/TopMenu/index.js @@ -8,7 +8,7 @@ import throttle from 'lodash.throttle' import styled from 'styled-components' import { media } from '../styles' // constants -import { HEADER } from '../../consts' +import { HEADER } from '../consts' const MIN_HEIGHT = 78 diff --git a/consts/index.js b/src/consts.js similarity index 100% rename from consts/index.js rename to src/consts.js