diff --git a/docs/en/next/api-pages.html b/docs/en/next/api-pages.html index a8feecf41c..3a0f8784a0 100644 --- a/docs/en/next/api-pages.html +++ b/docs/en/next/api-pages.html @@ -15,6 +15,21 @@
Edit

Pages and Styles

Docusaurus provides support for writing pages as React components inside the website/pages folder which will share the same header, footer, and styles as the rest of the site.

URLs for Pages

Any .js files in website/pages will be rendered to static html using the path of the file after "pages". Files in website/pages/en will also get copied out into pages and will OVERRIDE any files of the same name in pages. For example, the page for the website/pages/en/help.js file will be found at the url ${baseUrl}en/help.js as well as the url ${baseUrl}help.js, where ${baseUrl} is the baseUrl field set in your siteConfig.js file.

+

Titles for Pages

+

By default, the title of your page is <title> • <tagline> where title and tagline fields are set in siteConfig.js. You can exclude the tagline in the title by setting disableTitleTagline to true. If you want to set a specific title for your custom pages, add a title class property on your exported React component.

+

Example:

+
const React = require('react');
+
+class MyPage extends React.Component {
+  render() {
+    // ... your rendering code
+  }
+}
+
+MyPage.title = 'My Custom Title';
+
+module.exports = MyPage;
+

Page Require Paths

Docusaurus provides a few useful React components for users to write their own pages, found in the CompLibrary module. This module is provided as part of Docusaurus in node_modules/docusaurus, so to access it, pages in the pages folder are temporarily copied into node_modules/docusaurus when rendering to static html. As seen in the example files, this means that a user page at pages/en/index.js uses a require path to '../../core/CompLibrary.js' to import the provided components.

What this means to the user is that if you wish to use the CompLibrary module, make sure the require path is set correctly. For example, a page at page/mypage.js would use a path '../core/CompLibrary.js'.

@@ -130,7 +145,7 @@

You should configure your site's primary, secondary, and code block colors using the colors field in siteConfig as specified here. You can also configure other colors in the same way as described in the siteConfig doc.

You can provide your own custom styles by adding them anywhere in the website/static folder. Any .css files you provide in the static folder will get concatenated to the end of Docusaurus' provided styles, allowing you to add to or override Docusaurus default styles as you wish.

An easy way to figure out what classes you wish to override or add to is to start your server locally and use your browser's inspect element tool.

-