Changing homepage in config #11032
Replies: 1 comment
-
The usual way to do that is to use multiple instances of the docs plugin, and not having just one docs plugin with the exclude option. See https://docusaurus.io/docs/docs-multi-instance
Similarly, you can configure your site to use multiple instances of the pages plugin if needed. Or you can tell the pages plugin to look for pages on a different path: const isT = true; // use env variables or different config files
export default {
presets: [
[
'@docusaurus/preset-classic',
{
pages: {
path: isT ? 'src/pages/t' : 'src/pages/not-t',
},
},
],
], Then you can have:
If you want distinct homepages for T / not T, but also keep some shared pages, then I'd suggest to create a page plugin instance whose sole purpose would be to handle the distinct pages, and keep shared pages in For example you could have:
I don't believe we need a new config option, because our low-level primitives already allow you to do that. |
Beta Was this translation helpful? Give feedback.
-
Hello everyone
I'm working on a docusaurus website for multiple documentations. I have to make it work on multiple networks, multiple devices, some are for development, some with other docusaurus (making a basename mandatory), others are only for consultation and static.
Thanks to @slorber, I've managed to make the static version living with the server version by using two config files and changing which one is used with the npm command. I need it because the living version needs a basename which the static version does not.
For work purpose, i now need to make a new static website with only one documentation (let's call it the T software documentation) from the three in the actual version. With the "exclude" option in the config file, I've managed to make a new config file which exclude every page I don't need (without any trace in the build, which is exactly what I needed). I have even made a specific sidebar.T.js to excluse all trace of other tab / documentation.
What I'm not able to do is to change the homepage. I've created a small homepage for T called homepage.T.md and I want to change it as the "new" homepage. If I rename src/pages/index.js for src/pages/index.js.old and rename homepage.T.md for src/pages/index.md, it works... But it's a change for all the versions of the website, static or not. It's not perticulary hard and I know I already have to delete some of the static file copied by the build, but I know I will forget about it and prefer automatic way to do.
I can't even imagine if it is a hard work to add this option, but what would be perfect to me would be an option like "homepage" in the config file to let it know if I'm using the usual index.js or if I'm using another file for homepage. Even better : a way to select which subfolder from the static folder I want to copy would be awesome (I tried to exclude them, without success :( )
Of course, I'm also accepting any solution for this problem. I'm still feel like a beginner with docusaurus and I must have missed something.
Thanks a lot for your time and help :)
Beta Was this translation helpful? Give feedback.
All reactions