What is @docusaurus/preset-classic?
@docusaurus/preset-classic is a preset for Docusaurus, a static site generator. It provides a set of plugins and themes that help you quickly set up a documentation website with features like a blog, custom pages, and more.
What are @docusaurus/preset-classic's main functionalities?
Documentation
This feature allows you to set up a documentation site with a sidebar for navigation. The code sample shows how to configure the documentation plugin within the preset.
module.exports = {
presets: [
[
'@docusaurus/preset-classic',
{
docs: {
sidebarPath: require.resolve('./sidebars.js'),
},
},
],
],
};
Blog
This feature enables a blog section on your site. The code sample demonstrates how to configure the blog plugin to show reading time for each post.
module.exports = {
presets: [
[
'@docusaurus/preset-classic',
{
blog: {
showReadingTime: true,
},
},
],
],
};
Custom Pages
This feature allows you to create custom pages for your site. The code sample shows how to configure the pages plugin to use a specific directory for custom pages.
module.exports = {
presets: [
[
'@docusaurus/preset-classic',
{
pages: {
path: 'src/pages',
},
},
],
],
};
Theme
This feature lets you customize the theme of your site. The code sample demonstrates how to include a custom CSS file for additional styling.
module.exports = {
presets: [
[
'@docusaurus/preset-classic',
{
theme: {
customCss: require.resolve('./src/css/custom.css'),
},
},
],
],
};
Other packages similar to @docusaurus/preset-classic
gatsby
Gatsby is a React-based open-source framework for creating websites and apps. It offers a rich plugin ecosystem and is highly customizable, making it a strong alternative to Docusaurus for building static sites.
vuepress
VuePress is a Vue-powered static site generator. It is designed for creating documentation and offers a simple, minimalistic approach. It is a good alternative for those who prefer Vue over React.
mkdocs
MkDocs is a static site generator that's geared towards project documentation. It uses Markdown for content and offers a variety of themes. It is simpler and more lightweight compared to Docusaurus.
2.0.0-alpha.32 (2019-11-04)
Features
- Add
<Redirect>
component for client side redirect. Example Usage:
import React from 'react';
import {Redirect} from '@docusaurus/router';
function Home() {
return <Redirect to="/docs/test" />;
}
- Allow user to add custom HTML to footer items. #1905
- Added code block line highlighting feature (thanks @lex111)! If you have previously swizzled the
CodeBlock
theme component, it is recommended to update your source code to have this feature. (#1860)
Bug Fixes
- Fix
@theme/Tabs
component to be able to create tabs with only one item. - Fix MDX
@theme/Heading
component. If there is no id, it should not create anchor link. - Fixed a bug in which if
themeConfig.algolia
is not defined, the custom searchbar won't appear. If you've swizzled Algolia SearchBar
component before, please update your source code otherwise CSS might break. See #1909 for reference.
- <Fragment>
+ <div className="navbar__search" key="search-box">
- Slightly adjust search icon position to be more aligned on small width device. (#1893)
- Fix algolia styling bug, previously search suggestion result is sometimes hidden. (#1915)
- Changed the way we read the
USE_SSH
env variable during deployment to be the same as in v1. - Fix accessing
docs/
or /docs/xxxx
that does not match any existing doc page should return 404 (Not found) page, not blank page. (#1903) - Prioritize
@docusaurus/core
dependencies/ node_modules over user's node_modules. This fix a bug whereby if user has core-js@3 on its own node_modules but docusaurus depends on core-js@2, we previously encounter Module not found: core-js/modules/xxxx
(because core-js@3 doesn't have that). - Fix a bug where docs plugin add
/docs
route even if docs folder is empty. We also improved docs plugin test coverage to 100% for stability before working on docs versioning. (#1912)
Performance Improvement
- Reduce memory usage consumption. (#1900)
- Significantly reduce main bundle size and initial HTML payload on production build. Generated files from webpack is also shorter in name. (#1898)
- Simplify blog metadata. Previously, accessing
/blog/post-xxx
will request for next and prev blog post metadata too aside from target post metadata. We should only request target post metadata. (#1908)
Others
- Convert sitemap plugin to TypeScript. (#1894)
- Refactor dark mode toggle into a hook. (#1899)