diff --git a/netlify.toml b/netlify.toml index deebe4283..dedc82a9f 100644 --- a/netlify.toml +++ b/netlify.toml @@ -2,9 +2,9 @@ redirects = [ # Netlify {from = "https://spacy.netlify.com/*", to="https://spacy.io/:splat", force = true }, # Subdomain for branches - {from = "https://nightly.spacy.io/*", to="https://nightly-spacy-io.spacy.io/:splat", force = true, status = 200}, + {from = "https://nightly.spacy.io/*", to="https://spacy.io/:splat", force = true}, # TODO: update this with the v2 branch build once v3 is live (status = 200) - {from = "https://v2.spacy.io/*", to="https://spacy.io/:splat", force = true}, + {from = "https://v2.spacy.io/*", to="https://v2-spacy-io.spacy.io/:splat", force = true, status = 200}, # Old subdomains {from = "https://survey.spacy.io/*", to = "https://spacy.io", force = true}, {from = "http://survey.spacy.io/*", to = "https://spacy.io", force = true}, diff --git a/website/gatsby-config.js b/website/gatsby-config.js index ea88e4890..1d919dc33 100644 --- a/website/gatsby-config.js +++ b/website/gatsby-config.js @@ -19,11 +19,11 @@ const universe = require('./meta/universe.json') const DEFAULT_TEMPLATE = path.resolve('./src/templates/index.js') -const isNightly = !!+process.env.SPACY_NIGHTLY || site.nightlyBranches.includes(process.env.BRANCH) -const favicon = isNightly ? `src/images/icon_nightly.png` : `src/images/icon.png` -const binderBranch = isNightly ? 'nightly' : site.binderBranch -const siteUrl = isNightly ? site.siteUrlNightly : site.siteUrl -const domain = isNightly ? site.domainNightly : site.domain +const domain = process.env.BRANCH || site.domain +const siteUrl = `https://${domain}` +const isNightly = site.nightlyBranches.includes(domain) +const isLegacy = site.legacy || !!+process.env.SPACY_LEGACY +const favicon = `src/images/icon${isNightly ? '_nightly' : isLegacy ? '_legacy' : ''}.png` const branch = isNightly ? 'develop' : 'master' // Those variables are going to be replaced in the Markdown, e.g. %%GITHUB_SPACY @@ -53,7 +53,8 @@ module.exports = { counts: getCounts(models.languages), universe, nightly: isNightly, - binderBranch, + legacy: isLegacy, + binderBranch: domain, siteUrl, }, diff --git a/website/meta/site.json b/website/meta/site.json index fcff96b56..e84a282ae 100644 --- a/website/meta/site.json +++ b/website/meta/site.json @@ -2,11 +2,9 @@ "title": "spaCy", "description": "spaCy is a free open-source library for Natural Language Processing in Python. It features NER, POS tagging, dependency parsing, word vectors and more.", "slogan": "Industrial-strength Natural Language Processing in Python", - "siteUrl": "https://spacy.io", "domain": "spacy.io", - "siteUrlNightly": "https://nightly.spacy.io", - "domainNightly": "nightly.spacy.io", "nightlyBranches": ["nightly.spacy.io"], + "legacy": false, "email": "contact@explosion.ai", "company": "Explosion", "companyUrl": "https://explosion.ai", diff --git a/website/package.json b/website/package.json index def94a9c2..ef62f3c19 100644 --- a/website/package.json +++ b/website/package.json @@ -57,6 +57,7 @@ "build": "npm run python:install && npm run python:setup && gatsby build", "dev": "npm run python:setup && gatsby develop", "dev:nightly": "BRANCH=nightly.spacy.io npm run dev", + "dev:legacy": "SPACY_LEGACY=1 npm run dev", "lint": "eslint **", "clear": "rm -rf .cache", "test": "echo \"Write tests! -> https://gatsby.app/unit-testing\"", diff --git a/website/src/components/landing.js b/website/src/components/landing.js index 9c000f152..de054ddce 100644 --- a/website/src/components/landing.js +++ b/website/src/components/landing.js @@ -1,10 +1,12 @@ import React from 'react' import classNames from 'classnames' -import pattern from '../images/pattern_blue.jpg' +import patternDefault from '../images/pattern_blue.jpg' import patternNightly from '../images/pattern_nightly.jpg' -import patternOverlay from '../images/pattern_landing.jpg' -import patternOverlayNightly from '../images/pattern_landing_nightly.jpg' +import patternLegacy from '../images/pattern_legacy.jpg' +import overlayDefault from '../images/pattern_landing.jpg' +import overlayNightly from '../images/pattern_landing_nightly.jpg' +import overlayLegacy from '../images/pattern_landing_legacy.jpg' import Grid from './grid' import { Content } from './main' @@ -14,9 +16,15 @@ import { H1, H2, H3 } from './typography' import Link from './link' import classes from '../styles/landing.module.sass' -export const LandingHeader = ({ nightly, style = {}, children }) => { - const overlay = nightly ? patternOverlayNightly : patternOverlay - const wrapperStyle = { backgroundImage: `url(${nightly ? patternNightly : pattern})` } +function getPattern(nightly, legacy) { + if (nightly) return { pattern: patternNightly, overlay: overlayNightly } + if (legacy) return { pattern: patternLegacy, overlay: overlayLegacy } + return { pattern: patternDefault, overlay: overlayDefault } +} + +export const LandingHeader = ({ nightly, legacy, style = {}, children }) => { + const { pattern, overlay } = getPattern(nightly, legacy) + const wrapperStyle = { backgroundImage: `url(${pattern})` } const contentStyle = { backgroundImage: `url(${overlay})`, ...style } return (
diff --git a/website/src/components/main.js b/website/src/components/main.js index f0ca0ac04..a11a04305 100644 --- a/website/src/components/main.js +++ b/website/src/components/main.js @@ -6,6 +6,7 @@ import patternBlue from '../images/pattern_blue.jpg' import patternGreen from '../images/pattern_green.jpg' import patternPurple from '../images/pattern_purple.jpg' import patternNightly from '../images/pattern_nightly.jpg' +import patternLegacy from '../images/pattern_legacy.jpg' import classes from '../styles/main.module.sass' const patterns = { @@ -13,6 +14,7 @@ const patterns = { green: patternGreen, purple: patternPurple, nightly: patternNightly, + legacy: patternLegacy, } export const Content = ({ Component = 'div', className, children }) => ( diff --git a/website/src/components/seo.js b/website/src/components/seo.js index d5e6bc3e3..c50c40623 100644 --- a/website/src/components/seo.js +++ b/website/src/components/seo.js @@ -7,10 +7,12 @@ import socialImageDefault from '../images/social_default.jpg' import socialImageApi from '../images/social_api.jpg' import socialImageUniverse from '../images/social_universe.jpg' import socialImageNightly from '../images/social_nightly.jpg' +import socialImageLegacy from '../images/social_legacy.jpg' -function getPageTitle(title, sitename, slogan, sectionTitle, nightly) { +function getPageTitle(title, sitename, slogan, sectionTitle, nightly, legacy) { if (sectionTitle && title) { - return `${title} · ${sitename} ${sectionTitle}${nightly ? ' (nightly)' : ''}` + const suffix = nightly ? ' (nightly)' : legacy ? ' (legacy)' : '' + return `${title} · ${sitename} ${sectionTitle}${suffix}` } if (title) { return `${title} · ${sitename}` @@ -18,8 +20,9 @@ function getPageTitle(title, sitename, slogan, sectionTitle, nightly) { return `${sitename} · ${slogan}` } -function getImage(section, nightly) { +function getImage(section, nightly, legacy) { if (nightly) return socialImageNightly + if (legacy) return socialImageLegacy if (section === 'api') return socialImageApi if (section === 'universe') return socialImageUniverse return socialImageDefault @@ -33,6 +36,7 @@ export default function SEO({ sectionTitle, bodyClass, nightly, + legacy, }) { return ( { - const { nightly } = data.site.siteMetadata + const { nightly, legacy } = data.site.siteMetadata const pageContext = { title: '404 Error', searchExclude: true, isIndex: false } return (