Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs-only mode not working #21

Closed
Techassi opened this issue Dec 2, 2020 · 5 comments
Closed

Docs-only mode not working #21

Techassi opened this issue Dec 2, 2020 · 5 comments
Assignees
Labels
bug Something isn't working

Comments

@Techassi
Copy link

Techassi commented Dec 2, 2020

Bug description

If you use docs-only mode the indexer doesn't index directories but only the entry page.

Reproduction

Use docs-only mode described here

Environment

Package Versions

yarn list v1.22.5
├─ @cmfcmf/[email protected]
├─ @docusaurus/[email protected]
├─ @docusaurus/[email protected]
├─ @docusaurus/[email protected]
├─ @docusaurus/[email protected]
├─ @docusaurus/[email protected]
├─ @docusaurus/[email protected]
├─ @docusaurus/[email protected]
├─ @docusaurus/[email protected]
├─ @docusaurus/[email protected]
├─ @docusaurus/[email protected]
├─ @docusaurus/[email protected]
├─ @docusaurus/[email protected]
├─ @docusaurus/[email protected]
├─ @docusaurus/[email protected]
├─ @docusaurus/[email protected]
├─ @docusaurus/[email protected]
└─ @docusaurus/[email protected]

Node Version

v15.0.1

Docusaurus Environment

Are you using a custom theme? No

docusaurus.config.js

module.exports = {
    title: 'Title',
    tagline: '',
    url: 'example.com',
    baseUrl: '/',
    favicon: 'img/favicon.ico',
    organizationName: 'org',
    projectName: 'docs',
    themeConfig: {
        sidebarCollapsible: false,
        navbar: {
            title: 'Title',
            logo: {
                alt: 'Alt text',
                src: 'img/logo.svg',
            },
            items: [
                {
                    to: '/',
                    activeBasePath: 'docs',
                    label: 'Docs',
                    position: 'left',
                },
            ],
        },
        footer: {
            style: 'dark',
            copyright: `Built with Docusaurus.`,
        },
    },
    presets: [
        [
            '@docusaurus/preset-classic',
            {
                docs: {
                    routeBasePath: '/',
                    sidebarPath: require.resolve('./sidebars.js'),
                },
                theme: {
                    customCss: require.resolve('./src/css/custom.css'),
                },
            },
        ],
    ],
    plugins: [
        [
            require.resolve('@cmfcmf/docusaurus-search-local'),
            {
                docsRouteBasePath: '/', // must correspond to the base route path configured for the docs plugin
                indexBlog: false, // whether to index blog pages
                indexDocs: true, // whether to index docs pages
                language: ['en', 'de'], // language of your documentation, see next section
                docsOnlyMode: true,
            },
        ],
    ],
};

Additional context

I introduced a new configuration option called docsOnlyMode (see above). It basically skips the URL prefix check in the flatMap function call:

if (indexDocs && docsOnlyMode) {
    return { route, url, type: "docs" };
}

...

I don't know if thats the most elegant solution but for my case it works. I can also open a PR to further discuss this issue.

@Techassi Techassi added the bug Something isn't working label Dec 2, 2020
@franciscojaramillo
Copy link

Could you please open a PR, I'm having the same issue...

@cmfcmf
Copy link
Owner

cmfcmf commented Dec 15, 2020

Sorry for not responding sooner - if you could open a PR that fixes it, I'll gladly take a look and merge it.

@Techassi
Copy link
Author

Sure... I wil open a PR in a few days. Looking forward to your feedback!

@franciscojaramillo
Copy link

@Techassi Let me know if I can help in any way--very interested in getting this going

@Techassi
Copy link
Author

Fixed for me with version 0.5.0 (commit e76534b)

fashxp added a commit to fashxp/docusaurus-search-local that referenced this issue Mar 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants