diff --git a/antwar.config.js b/antwar.config.js index 14d66547209e..00e806cf11e9 100644 --- a/antwar.config.js +++ b/antwar.config.js @@ -13,6 +13,7 @@ module.exports = { output: 'build', title: 'webpack', keywords: ['webpack', 'javascript', 'web development', 'programming'], + pageTitle: function(config, pageTitle) { var siteName = config.name; @@ -22,12 +23,15 @@ module.exports = { return siteName + ' - ' + pageTitle; }, + plugins: [ prevnextPlugin() ], + layout: function() { return require('./components/site/site.jsx').default }, + paths: { '/': root( function() { @@ -39,14 +43,6 @@ module.exports = { } ), - 'get-started': { - redirects: { - '': '/guides/get-started', - 'install-webpack': '/guides/installation', - 'why-webpack': '/guides/why-webpack', - } - }, - concepts: section( 'Concepts', function() { @@ -73,67 +69,61 @@ module.exports = { } ), - development: section( - 'Development', + documentation: section( + 'Documentation', function() { return require.context( - 'json-loader!yaml-frontmatter-loader!./content/development', - true, + 'json-loader!yaml-frontmatter-loader!./content/documentation', + false, /^\.\/.*\.md$/ ); } ), - configuration: section( - 'Configuration', + 'documentation/api': section( + 'API', function() { return require.context( - 'json-loader!yaml-frontmatter-loader!./content/configuration', + 'json-loader!yaml-frontmatter-loader!./content/documentation/api', false, /^\.\/.*\.md$/ ); }, { - 'external-configs': 'javascript-alternatives' + 'passing-a-config': 'configuration-types' } ), - api: section( - 'API', + // This would be better as a nested (third level) directory + // Consider fixing somehow and moving to redirects? + 'documentation/api/plugins': section( + 'API | Plugins', function() { return require.context( - 'json-loader!yaml-frontmatter-loader!./content/api', + 'json-loader!yaml-frontmatter-loader!./content/documentation/api/plugins', false, /^\.\/.*\.md$/ ); - }, { - 'passing-a-config': 'configuration-types' } ), - 'api/plugins': section( - 'API', + 'documentation/configuration': section( + 'Configuration', function() { return require.context( - 'json-loader!yaml-frontmatter-loader!./content/api/plugins', + 'json-loader!yaml-frontmatter-loader!./content/documentation/configuration', false, /^\.\/.*\.md$/ ); + }, { + 'external-configs': 'javascript-alternatives' } ), - pluginsapi: { - redirects: { - '': '/api/plugins', - 'compiler': '/api/plugins/compiler', - 'template': '/api/plugins/template' - } - }, - - loaders: section( + 'documentation/loaders': section( 'Loaders', function() { const content = require.context( - 'json-loader!yaml-frontmatter-loader!./content/loaders', + 'json-loader!yaml-frontmatter-loader!./content/documentation/loaders', false, /^\.\/.*\.md$/ ); @@ -146,11 +136,11 @@ module.exports = { } ), - plugins: section( + 'documentation/plugins': section( 'Plugins', function() { const content = require.context( - 'json-loader!yaml-frontmatter-loader!./content/plugins', + 'json-loader!yaml-frontmatter-loader!./content/documentation/plugins', false, /^\.\/.*\.md$/ ); @@ -163,6 +153,18 @@ module.exports = { } ), + // Maybe move to support/development? + 'documentation/development': section( + 'Development', + function() { + return require.context( + 'json-loader!yaml-frontmatter-loader!./content/documentation/development', + true, + /^\.\/.*\.md$/ + ); + } + ), + support: section( 'Support', function() { @@ -180,23 +182,30 @@ module.exports = { } }, - 'vote/feedback': { + organization: { path() { - return require('./components/vote/list.jsx').default + return require('./components/organization/organization.jsx').default } }, - 'vote/moneyDistribution': { - path() { - return require('./components/vote/list.jsx').default + + // Redirects: Everything below is just redirects from old sections + + 'get-started': { + redirects: { + '': '/guides/get-started', + 'install-webpack': '/guides/installation', + 'why-webpack': '/guides/why-webpack', } }, - organization: { - path() { - return require('./components/organization/organization.jsx').default + pluginsapi: { + redirects: { + '': '/api/plugins', + 'compiler': '/api/plugins/compiler', + 'template': '/api/plugins/template' } - } + }, } }; diff --git a/components/navigation/navigation-links.json b/components/navigation/navigation-links.json new file mode 100644 index 000000000000..4fd46c6cc7bb --- /dev/null +++ b/components/navigation/navigation-links.json @@ -0,0 +1,33 @@ +[ + { + "title": "Concepts", + "url": "concepts" + }, + { + "title": "Guides", + "url": "guides" + }, + { + "title": "Documentation", + "url": "documentation/configuration", + "children": [ + { "title": "API", "url": "documentation/api" }, + { "title": "Configuration", "url": "documentation/configuration" }, + { "title": "Loaders", "url": "documentation/loaders" }, + { "title": "Plugins", "url": "documentation/plugins" }, + { "title": "Development", "url": "documentation/development" } + ] + }, + { + "title": "Support", + "url": "support" + }, + { + "title": "Blog", + "url": "//medium.com/webpack" + }, + { + "title": "Donate", + "url": "//opencollective.com/webpack" + } +] diff --git a/components/navigation/navigation.jsx b/components/navigation/navigation.jsx index d62b846819eb..8dea707d70ef 100644 --- a/components/navigation/navigation.jsx +++ b/components/navigation/navigation.jsx @@ -7,42 +7,9 @@ import USFlag from '../../assets/language/english.png'; import ChineseFlag from '../../assets/language/chinese.png'; // TODO: Maybe by updating the routing scheme later on we can avoid hardcoding this? -let Sections = [ - { - title: 'Concepts', - url: 'concepts' - }, - { - title: 'Guides', - url: 'guides' - }, - { - title: 'Documentation', - url: 'configuration', - children: [ - { title: 'CLI', url: 'api/cli' }, - { title: 'API', url: 'api' }, - { title: 'Configuration', url: 'configuration' }, - { title: 'Loaders', url: 'loaders' }, - { title: 'Plugins', url: 'plugins' }, - { title: 'Development', url: 'development' } - ] - }, - { - title: 'Donate', - url: '//opencollective.com/webpack' - }, - { - title: 'Blog', - url: '//medium.com/webpack' - }, - { - title: 'Support', - url: 'support' - } -]; +import Links from './navigation-links.json'; -// TODO: Move back to using state once we can handle algolia on our own +// TODO: Migrate to react-banner export default class Navigation extends React.Component { render() { let { pageUrl = '' } = this.props; @@ -60,16 +27,16 @@ export default class Navigation extends React.Component {