11# wordpress-to-docusaurus-plugin
22
3- A Docusaurus Plugin which will import content from Wordpress based on a GraphQL query.
3+ A Docusaurus Plugin which will import Blog content from Wordpress based on a GraphQL query.
44
55Designed to work with Blog posts but could be used as an example for anyone, trying to
6- create something bespoke .
6+ create a headless CMS solution .
77
88## Configuration
99
@@ -17,9 +17,10 @@ Add this plugin to the plugins array in `docusaurus.config.js`.
1717
1818```
1919module.exports = {
20- // ...
20+ // ... Rest of your Docusaurus config
2121 plugins: [
22- [require.resolve('wordpress-to-docusaurus-plugin'),
22+ [
23+ require.resolve('wordpress-to-docusaurus-plugin'),
2324 {
2425 // URL of the Wordpress GraphQL endpoint
2526 url: 'http://my-wordpress-instance/graphql',
@@ -31,38 +32,38 @@ module.exports = {
3132
3233## Extending
3334
35+ ### createFrontmatter
36+
37+ ` createFrontmatter: (post: Post) => string `
38+
39+ The` createFrontmatter ` option can be configured to create custom Frontmatter.
40+
41+ ### createPreview
42+
43+ ` createPreview: (post: Post) => string `
44+
45+ The` createPreview ` option can be configured to create a custom preview.
46+
3447### outputPath
3548
3649` outputPath?: string `
3750
38- The ` outputPath ` option can be ued to define a custom output path (default=blog).
51+ The ` outputPath ` option can be used to define a custom output path (default=blog).
3952
4053### query
4154
4255` query?: string `
4356
44- The ` query ` option can be ued to define a cutom query.
57+ The ` query ` option can be used to define a custom query.
4558
4659### translateContent
4760
4861` translateContent: (content: string, post: Post) => string `
4962
50- The` translateContent ` option can be configured to convert the basic WP html semantics back to
63+ The ` translateContent ` option can be configured to convert the Wordpress HTML back to
5164markdown, you can extend the default translate function or replace it.
5265
53- ### createFrontmatter
54-
55- ` createFrontmatter: (post: Post) => string `
56-
57- The` createFrontmatter ` option can be configured to create custom Frontmatter.
58-
59- ### createPreview
60-
61- ` createPreview: (post: Post) => string `
62-
63- The` createPreview ` option can be configured to create a custom preview.
64-
65- ### Sample config
66+ ### Sample Docusaurus config entry
6667
6768```
6869import { defaultTranslate } from 'wordpress-to-docusaurus-plugin';
0 commit comments