mirror of
https://github.com/facebook/docusaurus.git
synced 2025-08-03 16:59:06 +02:00
feat(v2): pluginify pages (#1278)
* feat(v2): convert pages into a plugin * fix: update tests
This commit is contained in:
parent
2da59ed4af
commit
398d7c7ae4
21 changed files with 287 additions and 257 deletions
|
@ -14,8 +14,6 @@ import styles from './styles.module.css';
|
|||
|
||||
function Footer() {
|
||||
const context = useContext(DocusaurusContext);
|
||||
const {pagesMetadatas} = context;
|
||||
|
||||
return (
|
||||
<footer className={styles.footer}>
|
||||
<section className={styles.footerRow}>
|
||||
|
@ -79,11 +77,11 @@ function Footer() {
|
|||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
{/* This is for v2 development only to know which are the available page */}
|
||||
{/* This is for v2 development only to know the available pages. */}
|
||||
<div className={styles.footerColumn}>
|
||||
<h3 className={styles.footerColumnTitle}>Pages</h3>
|
||||
<ul className={styles.footerList}>
|
||||
{pagesMetadatas.map(metadata => (
|
||||
{context.pagesMetadata.map(metadata => (
|
||||
<li key={metadata.permalink} className={styles.footerListItem}>
|
||||
<Link className={styles.footerLink} to={metadata.permalink}>
|
||||
{metadata.permalink}
|
||||
|
|
|
@ -12,11 +12,12 @@ import Layout from '@theme/Layout'; // eslint-disable-line
|
|||
|
||||
import DocusaurusContext from '@docusaurus/context';
|
||||
|
||||
function Pages({children}) {
|
||||
function Pages({modules}) {
|
||||
const context = useContext(DocusaurusContext);
|
||||
const {metadata = {}, siteConfig = {}} = context;
|
||||
const {baseUrl, favicon} = siteConfig;
|
||||
const {language} = metadata;
|
||||
const PageContents = modules[0];
|
||||
|
||||
return (
|
||||
<Layout>
|
||||
|
@ -25,7 +26,7 @@ function Pages({children}) {
|
|||
{language && <html lang={language} />}
|
||||
{language && <meta name="docsearch:language" content={language} />}
|
||||
</Head>
|
||||
{children}
|
||||
<PageContents />
|
||||
<Footer />
|
||||
</Layout>
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue