mirror of
https://github.com/facebook/docusaurus.git
synced 2025-06-04 20:02:54 +02:00
feat(v2): rewrite docs loading strategy (#1092)
* feat(v2): rewrite docs loading strategy * Prettify * Lint * Allow resolving from library root * minor changes, refactor * copyright header
This commit is contained in:
parent
c9243e8922
commit
13a21b2374
36 changed files with 520 additions and 327 deletions
|
@ -5,26 +5,28 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
/* eslint-disable */
|
||||
import React from 'react';
|
||||
import {Link} from 'react-router-dom';
|
||||
import Helmet from 'react-helmet';
|
||||
import React, {useContext} from 'react';
|
||||
import Head from '@docusaurus/head';
|
||||
import Layout from '@theme/Layout'; // eslint-disable-line
|
||||
|
||||
export default class Pages extends React.Component {
|
||||
render() {
|
||||
const {metadata, children, siteConfig = {}} = this.props;
|
||||
const {baseUrl, favicon} = siteConfig;
|
||||
const {language} = metadata;
|
||||
return (
|
||||
<Layout {...this.props}>
|
||||
<Helmet defaultTitle={siteConfig.title}>
|
||||
{favicon && <link rel="shortcut icon" href={baseUrl + favicon} />}
|
||||
{language && <html lang={language} />}
|
||||
{language && <meta name="docsearch:language" content={language} />}
|
||||
</Helmet>
|
||||
{children}
|
||||
</Layout>
|
||||
);
|
||||
}
|
||||
import DocusaurusContext from '@docusaurus/context';
|
||||
|
||||
function Pages({children}) {
|
||||
const context = useContext(DocusaurusContext);
|
||||
const {metadata = {}, siteConfig = {}} = context;
|
||||
const {baseUrl, favicon} = siteConfig;
|
||||
const {language} = metadata;
|
||||
|
||||
return (
|
||||
<Layout>
|
||||
<Head defaultTitle={siteConfig.title}>
|
||||
{favicon && <link rel="shortcut icon" href={baseUrl + favicon} />}
|
||||
{language && <html lang={language} />}
|
||||
{language && <meta name="docsearch:language" content={language} />}
|
||||
</Head>
|
||||
{children}
|
||||
</Layout>
|
||||
);
|
||||
}
|
||||
|
||||
export default Pages;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue