💫 Update website (#3285)
<!--- Provide a general summary of your changes in the title. -->
## Description
The new website is implemented using [Gatsby](https://www.gatsbyjs.org) with [Remark](https://github.com/remarkjs/remark) and [MDX](https://mdxjs.com/). This allows authoring content in **straightforward Markdown** without the usual limitations. Standard elements can be overwritten with powerful [React](http://reactjs.org/) components and wherever Markdown syntax isn't enough, JSX components can be used. Hopefully, this update will also make it much easier to contribute to the docs. Once this PR is merged, I'll implement auto-deployment via [Netlify](https://netlify.com) on a specific branch (to avoid building the website on every PR). There's a bunch of other cool stuff that the new setup will allow us to do – including writing front-end tests, service workers, offline support, implementing a search and so on.
This PR also includes various new docs pages and content.
Resolves #3270. Resolves #3222. Resolves #2947. Resolves #2837.
### Types of change
enhancement
## Checklist
<!--- Before you submit the PR, go over this checklist and make sure you can
tick off all the boxes. [] -> [x] -->
- [x] I have submitted the spaCy Contributor Agreement.
- [x] I ran the tests, and all new and existing tests passed.
- [x] My changes don't require a change to the documentation, or if they do, I've added all required information.
2019-02-17 18:31:19 +00:00
|
|
|
const autoprefixer = require('autoprefixer')
|
|
|
|
const path = require('path')
|
|
|
|
|
2020-10-01 20:27:45 +00:00
|
|
|
// https://florian.ec/blog/gatsby-build-netlify-segmentation-fault/
|
|
|
|
const sharp = require('sharp')
|
|
|
|
sharp.cache(false)
|
|
|
|
sharp.simd(false)
|
|
|
|
|
💫 Update website (#3285)
<!--- Provide a general summary of your changes in the title. -->
## Description
The new website is implemented using [Gatsby](https://www.gatsbyjs.org) with [Remark](https://github.com/remarkjs/remark) and [MDX](https://mdxjs.com/). This allows authoring content in **straightforward Markdown** without the usual limitations. Standard elements can be overwritten with powerful [React](http://reactjs.org/) components and wherever Markdown syntax isn't enough, JSX components can be used. Hopefully, this update will also make it much easier to contribute to the docs. Once this PR is merged, I'll implement auto-deployment via [Netlify](https://netlify.com) on a specific branch (to avoid building the website on every PR). There's a bunch of other cool stuff that the new setup will allow us to do – including writing front-end tests, service workers, offline support, implementing a search and so on.
This PR also includes various new docs pages and content.
Resolves #3270. Resolves #3222. Resolves #2947. Resolves #2837.
### Types of change
enhancement
## Checklist
<!--- Before you submit the PR, go over this checklist and make sure you can
tick off all the boxes. [] -> [x] -->
- [x] I have submitted the spaCy Contributor Agreement.
- [x] I ran the tests, and all new and existing tests passed.
- [x] My changes don't require a change to the documentation, or if they do, I've added all required information.
2019-02-17 18:31:19 +00:00
|
|
|
// Markdown plugins
|
|
|
|
const wrapSectionPlugin = require('./src/plugins/remark-wrap-section.js')
|
|
|
|
const customAttrsPlugin = require('./src/plugins/remark-custom-attrs.js')
|
|
|
|
const codeBlocksPlugin = require('./src/plugins/remark-code-blocks.js')
|
|
|
|
|
|
|
|
// Import metadata
|
|
|
|
const site = require('./meta/site.json')
|
|
|
|
const sidebars = require('./meta/sidebars.json')
|
|
|
|
const models = require('./meta/languages.json')
|
|
|
|
const universe = require('./meta/universe.json')
|
|
|
|
|
|
|
|
const DEFAULT_TEMPLATE = path.resolve('./src/templates/index.js')
|
2020-07-01 12:05:11 +00:00
|
|
|
|
2020-07-01 12:42:59 +00:00
|
|
|
const isNightly = !!+process.env.SPACY_NIGHTLY || site.nightlyBranches.includes(process.env.BRANCH)
|
2020-07-01 12:33:33 +00:00
|
|
|
const favicon = isNightly ? `src/images/icon_nightly.png` : `src/images/icon.png`
|
|
|
|
const binderBranch = isNightly ? 'nightly' : site.binderBranch
|
2020-07-01 12:42:59 +00:00
|
|
|
const siteUrl = isNightly ? site.siteUrlNightly : site.siteUrl
|
2020-07-18 22:02:29 +00:00
|
|
|
const domain = isNightly ? site.domainNightly : site.domain
|
2020-09-12 15:05:10 +00:00
|
|
|
const branch = isNightly ? 'develop' : 'master'
|
|
|
|
|
|
|
|
// Those variables are going to be replaced in the Markdown, e.g. %%GITHUB_SPACY
|
|
|
|
const replacements = {
|
|
|
|
GITHUB_SPACY: `https://github.com/explosion/spaCy/tree/${branch}`,
|
2020-09-24 08:13:41 +00:00
|
|
|
GITHUB_PROJECTS: `https://github.com/${site.projectsRepo}`,
|
2020-09-12 15:05:10 +00:00
|
|
|
}
|
💫 Update website (#3285)
<!--- Provide a general summary of your changes in the title. -->
## Description
The new website is implemented using [Gatsby](https://www.gatsbyjs.org) with [Remark](https://github.com/remarkjs/remark) and [MDX](https://mdxjs.com/). This allows authoring content in **straightforward Markdown** without the usual limitations. Standard elements can be overwritten with powerful [React](http://reactjs.org/) components and wherever Markdown syntax isn't enough, JSX components can be used. Hopefully, this update will also make it much easier to contribute to the docs. Once this PR is merged, I'll implement auto-deployment via [Netlify](https://netlify.com) on a specific branch (to avoid building the website on every PR). There's a bunch of other cool stuff that the new setup will allow us to do – including writing front-end tests, service workers, offline support, implementing a search and so on.
This PR also includes various new docs pages and content.
Resolves #3270. Resolves #3222. Resolves #2947. Resolves #2837.
### Types of change
enhancement
## Checklist
<!--- Before you submit the PR, go over this checklist and make sure you can
tick off all the boxes. [] -> [x] -->
- [x] I have submitted the spaCy Contributor Agreement.
- [x] I ran the tests, and all new and existing tests passed.
- [x] My changes don't require a change to the documentation, or if they do, I've added all required information.
2019-02-17 18:31:19 +00:00
|
|
|
|
2020-09-13 09:31:50 +00:00
|
|
|
/**
|
|
|
|
* Compute the overall total counts of models and languages
|
|
|
|
*/
|
|
|
|
function getCounts(langs = []) {
|
|
|
|
return {
|
|
|
|
langs: langs.length,
|
|
|
|
modelLangs: langs.filter(({ models }) => models && !!models.length).length,
|
|
|
|
starterLangs: langs.filter(({ starters }) => starters && !!starters.length).length,
|
|
|
|
models: langs.map(({ models }) => (models ? models.length : 0)).reduce((a, b) => a + b, 0),
|
|
|
|
starters: langs
|
|
|
|
.map(({ starters }) => (starters ? starters.length : 0))
|
|
|
|
.reduce((a, b) => a + b, 0),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
💫 Update website (#3285)
<!--- Provide a general summary of your changes in the title. -->
## Description
The new website is implemented using [Gatsby](https://www.gatsbyjs.org) with [Remark](https://github.com/remarkjs/remark) and [MDX](https://mdxjs.com/). This allows authoring content in **straightforward Markdown** without the usual limitations. Standard elements can be overwritten with powerful [React](http://reactjs.org/) components and wherever Markdown syntax isn't enough, JSX components can be used. Hopefully, this update will also make it much easier to contribute to the docs. Once this PR is merged, I'll implement auto-deployment via [Netlify](https://netlify.com) on a specific branch (to avoid building the website on every PR). There's a bunch of other cool stuff that the new setup will allow us to do – including writing front-end tests, service workers, offline support, implementing a search and so on.
This PR also includes various new docs pages and content.
Resolves #3270. Resolves #3222. Resolves #2947. Resolves #2837.
### Types of change
enhancement
## Checklist
<!--- Before you submit the PR, go over this checklist and make sure you can
tick off all the boxes. [] -> [x] -->
- [x] I have submitted the spaCy Contributor Agreement.
- [x] I ran the tests, and all new and existing tests passed.
- [x] My changes don't require a change to the documentation, or if they do, I've added all required information.
2019-02-17 18:31:19 +00:00
|
|
|
module.exports = {
|
|
|
|
siteMetadata: {
|
|
|
|
...site,
|
|
|
|
sidebars,
|
|
|
|
...models,
|
2020-09-13 09:31:50 +00:00
|
|
|
counts: getCounts(models.languages),
|
💫 Update website (#3285)
<!--- Provide a general summary of your changes in the title. -->
## Description
The new website is implemented using [Gatsby](https://www.gatsbyjs.org) with [Remark](https://github.com/remarkjs/remark) and [MDX](https://mdxjs.com/). This allows authoring content in **straightforward Markdown** without the usual limitations. Standard elements can be overwritten with powerful [React](http://reactjs.org/) components and wherever Markdown syntax isn't enough, JSX components can be used. Hopefully, this update will also make it much easier to contribute to the docs. Once this PR is merged, I'll implement auto-deployment via [Netlify](https://netlify.com) on a specific branch (to avoid building the website on every PR). There's a bunch of other cool stuff that the new setup will allow us to do – including writing front-end tests, service workers, offline support, implementing a search and so on.
This PR also includes various new docs pages and content.
Resolves #3270. Resolves #3222. Resolves #2947. Resolves #2837.
### Types of change
enhancement
## Checklist
<!--- Before you submit the PR, go over this checklist and make sure you can
tick off all the boxes. [] -> [x] -->
- [x] I have submitted the spaCy Contributor Agreement.
- [x] I ran the tests, and all new and existing tests passed.
- [x] My changes don't require a change to the documentation, or if they do, I've added all required information.
2019-02-17 18:31:19 +00:00
|
|
|
universe,
|
2020-07-01 12:05:11 +00:00
|
|
|
nightly: isNightly,
|
2020-07-01 12:33:33 +00:00
|
|
|
binderBranch,
|
2020-07-01 12:42:59 +00:00
|
|
|
siteUrl,
|
💫 Update website (#3285)
<!--- Provide a general summary of your changes in the title. -->
## Description
The new website is implemented using [Gatsby](https://www.gatsbyjs.org) with [Remark](https://github.com/remarkjs/remark) and [MDX](https://mdxjs.com/). This allows authoring content in **straightforward Markdown** without the usual limitations. Standard elements can be overwritten with powerful [React](http://reactjs.org/) components and wherever Markdown syntax isn't enough, JSX components can be used. Hopefully, this update will also make it much easier to contribute to the docs. Once this PR is merged, I'll implement auto-deployment via [Netlify](https://netlify.com) on a specific branch (to avoid building the website on every PR). There's a bunch of other cool stuff that the new setup will allow us to do – including writing front-end tests, service workers, offline support, implementing a search and so on.
This PR also includes various new docs pages and content.
Resolves #3270. Resolves #3222. Resolves #2947. Resolves #2837.
### Types of change
enhancement
## Checklist
<!--- Before you submit the PR, go over this checklist and make sure you can
tick off all the boxes. [] -> [x] -->
- [x] I have submitted the spaCy Contributor Agreement.
- [x] I ran the tests, and all new and existing tests passed.
- [x] My changes don't require a change to the documentation, or if they do, I've added all required information.
2019-02-17 18:31:19 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
plugins: [
|
|
|
|
{
|
|
|
|
resolve: `gatsby-plugin-svgr`,
|
|
|
|
options: {
|
|
|
|
svgo: false,
|
|
|
|
svgoConfig: {
|
|
|
|
removeViewBox: false,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
resolve: `gatsby-plugin-sass`,
|
|
|
|
options: {
|
|
|
|
indentedSyntax: true,
|
|
|
|
postCssPlugins: [autoprefixer()],
|
|
|
|
cssLoaderOptions: {
|
|
|
|
localIdentName:
|
|
|
|
process.env.NODE_ENV == 'development'
|
|
|
|
? '[name]-[local]-[hash:8]'
|
|
|
|
: '[hash:8]',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
`gatsby-plugin-react-helmet`,
|
|
|
|
{
|
|
|
|
resolve: `gatsby-source-filesystem`,
|
|
|
|
options: {
|
|
|
|
name: `docs`,
|
|
|
|
path: `${__dirname}/docs`,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
resolve: `gatsby-source-filesystem`,
|
|
|
|
options: {
|
|
|
|
name: `pages`,
|
|
|
|
path: `${__dirname}/src/pages`,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
resolve: `gatsby-source-filesystem`,
|
|
|
|
options: {
|
|
|
|
name: `images`,
|
|
|
|
path: `${__dirname}/src/images`,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
resolve: `gatsby-source-filesystem`,
|
|
|
|
options: {
|
|
|
|
name: `docsImages`,
|
|
|
|
path: `${__dirname}/docs/images`,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
resolve: `gatsby-mdx`,
|
|
|
|
options: {
|
|
|
|
root: __dirname,
|
|
|
|
extensions: ['.md', '.mdx'],
|
|
|
|
defaultLayouts: {
|
|
|
|
pages: DEFAULT_TEMPLATE,
|
|
|
|
},
|
|
|
|
mdPlugins: [customAttrsPlugin, wrapSectionPlugin, codeBlocksPlugin],
|
|
|
|
gatsbyRemarkPlugins: [
|
|
|
|
{
|
|
|
|
resolve: `gatsby-remark-smartypants`,
|
|
|
|
options: {
|
|
|
|
backticks: false,
|
|
|
|
dashes: 'oldschool',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
resolve: `gatsby-remark-images`,
|
|
|
|
options: {
|
|
|
|
maxWidth: 650,
|
|
|
|
linkImagesToOriginal: true,
|
|
|
|
sizeByPixelDensity: false,
|
|
|
|
showCaptions: true,
|
|
|
|
quality: 80,
|
|
|
|
withWebp: { quality: 80 },
|
|
|
|
wrapperStyle: { marginBottom: '20px' },
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
// NB: This need to run after gatsby-remark-images!
|
|
|
|
resolve: `gatsby-remark-unwrap-images`,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
resolve: `gatsby-remark-copy-linked-files`,
|
|
|
|
},
|
2020-09-12 15:05:10 +00:00
|
|
|
{
|
|
|
|
resolve: 'gatsby-remark-find-replace',
|
|
|
|
options: {
|
|
|
|
replacements,
|
|
|
|
prefix: '%%',
|
|
|
|
},
|
|
|
|
},
|
💫 Update website (#3285)
<!--- Provide a general summary of your changes in the title. -->
## Description
The new website is implemented using [Gatsby](https://www.gatsbyjs.org) with [Remark](https://github.com/remarkjs/remark) and [MDX](https://mdxjs.com/). This allows authoring content in **straightforward Markdown** without the usual limitations. Standard elements can be overwritten with powerful [React](http://reactjs.org/) components and wherever Markdown syntax isn't enough, JSX components can be used. Hopefully, this update will also make it much easier to contribute to the docs. Once this PR is merged, I'll implement auto-deployment via [Netlify](https://netlify.com) on a specific branch (to avoid building the website on every PR). There's a bunch of other cool stuff that the new setup will allow us to do – including writing front-end tests, service workers, offline support, implementing a search and so on.
This PR also includes various new docs pages and content.
Resolves #3270. Resolves #3222. Resolves #2947. Resolves #2837.
### Types of change
enhancement
## Checklist
<!--- Before you submit the PR, go over this checklist and make sure you can
tick off all the boxes. [] -> [x] -->
- [x] I have submitted the spaCy Contributor Agreement.
- [x] I ran the tests, and all new and existing tests passed.
- [x] My changes don't require a change to the documentation, or if they do, I've added all required information.
2019-02-17 18:31:19 +00:00
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
`gatsby-transformer-sharp`,
|
|
|
|
`gatsby-plugin-sharp`,
|
|
|
|
`gatsby-plugin-catch-links`,
|
|
|
|
`gatsby-plugin-sitemap`,
|
|
|
|
{
|
|
|
|
resolve: `gatsby-plugin-manifest`,
|
|
|
|
options: {
|
|
|
|
name: site.title,
|
|
|
|
short_name: site.title,
|
|
|
|
start_url: `/`,
|
|
|
|
background_color: site.theme,
|
|
|
|
theme_color: site.theme,
|
|
|
|
display: `minimal-ui`,
|
2020-07-01 12:33:33 +00:00
|
|
|
icon: favicon,
|
💫 Update website (#3285)
<!--- Provide a general summary of your changes in the title. -->
## Description
The new website is implemented using [Gatsby](https://www.gatsbyjs.org) with [Remark](https://github.com/remarkjs/remark) and [MDX](https://mdxjs.com/). This allows authoring content in **straightforward Markdown** without the usual limitations. Standard elements can be overwritten with powerful [React](http://reactjs.org/) components and wherever Markdown syntax isn't enough, JSX components can be used. Hopefully, this update will also make it much easier to contribute to the docs. Once this PR is merged, I'll implement auto-deployment via [Netlify](https://netlify.com) on a specific branch (to avoid building the website on every PR). There's a bunch of other cool stuff that the new setup will allow us to do – including writing front-end tests, service workers, offline support, implementing a search and so on.
This PR also includes various new docs pages and content.
Resolves #3270. Resolves #3222. Resolves #2947. Resolves #2837.
### Types of change
enhancement
## Checklist
<!--- Before you submit the PR, go over this checklist and make sure you can
tick off all the boxes. [] -> [x] -->
- [x] I have submitted the spaCy Contributor Agreement.
- [x] I ran the tests, and all new and existing tests passed.
- [x] My changes don't require a change to the documentation, or if they do, I've added all required information.
2019-02-17 18:31:19 +00:00
|
|
|
},
|
|
|
|
},
|
2020-07-18 22:02:29 +00:00
|
|
|
{
|
|
|
|
resolve: `gatsby-plugin-plausible`,
|
|
|
|
options: { domain },
|
|
|
|
},
|
2020-07-01 12:50:58 +00:00
|
|
|
{
|
|
|
|
resolve: 'gatsby-plugin-robots-txt',
|
|
|
|
options: {
|
|
|
|
host: siteUrl,
|
|
|
|
sitemap: `${siteUrl}/sitemap.xml`,
|
|
|
|
// If we're in a special state (nightly, legacy) prevent indexing
|
|
|
|
resolveEnv: () => (isNightly ? 'development' : 'production'),
|
|
|
|
env: {
|
|
|
|
production: {
|
|
|
|
policy: [{ userAgent: '*', allow: '/' }],
|
|
|
|
},
|
|
|
|
development: {
|
|
|
|
policy: [{ userAgent: '*', disallow: ['/'] }],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
💫 Update website (#3285)
<!--- Provide a general summary of your changes in the title. -->
## Description
The new website is implemented using [Gatsby](https://www.gatsbyjs.org) with [Remark](https://github.com/remarkjs/remark) and [MDX](https://mdxjs.com/). This allows authoring content in **straightforward Markdown** without the usual limitations. Standard elements can be overwritten with powerful [React](http://reactjs.org/) components and wherever Markdown syntax isn't enough, JSX components can be used. Hopefully, this update will also make it much easier to contribute to the docs. Once this PR is merged, I'll implement auto-deployment via [Netlify](https://netlify.com) on a specific branch (to avoid building the website on every PR). There's a bunch of other cool stuff that the new setup will allow us to do – including writing front-end tests, service workers, offline support, implementing a search and so on.
This PR also includes various new docs pages and content.
Resolves #3270. Resolves #3222. Resolves #2947. Resolves #2837.
### Types of change
enhancement
## Checklist
<!--- Before you submit the PR, go over this checklist and make sure you can
tick off all the boxes. [] -> [x] -->
- [x] I have submitted the spaCy Contributor Agreement.
- [x] I ran the tests, and all new and existing tests passed.
- [x] My changes don't require a change to the documentation, or if they do, I've added all required information.
2019-02-17 18:31:19 +00:00
|
|
|
`gatsby-plugin-offline`,
|
|
|
|
],
|
|
|
|
}
|