Giter Site home page Giter Site logo

Comments (4)

slorber avatar slorber commented on June 3, 2024

+1

We got this reported to the main Docusaurus repo too: facebook/docusaurus#5267

If that helps, here's the logic we use to emit HTML files:

https://github.com/slorber/static-site-generator-webpack-plugin/blob/master/index.js#L167

function pathToAssetName(outputPath, preferFoldersOutput) {
  var outputFileName = outputPath.replace(/^(\/|\\)/, ''); // Remove leading slashes for webpack-dev-server

  // Paths ending with .html are left untouched
  if (/\.(html?)$/i.test(outputFileName)) {
    return outputFileName;
  }

  // Legacy retro-compatible behavior
  if (typeof preferFoldersOutput === 'undefined') {
    return path.join(outputFileName, 'index.html');
  }

  // New behavior: we can say if we prefer file/folder output
  // Useful resource: https://github.com/slorber/trailing-slash-guide
  if ( outputPath === "" || outputPath.endsWith("/") || preferFoldersOutput ) {
    return path.join(outputFileName, 'index.html');
  }
  else {
    return `${outputFileName}.html`;
  }
}

You can consider preferFoldersOutput === siteConfig.trailingSlash

Eventually, it may be safer (probably also less performant :s) to test for the file to exist here: https://github.com/easyops-cn/docusaurus-search-local/blob/a7b1b3a98bda9c72859ebc762efa5eb874dbd7e9/src/server/utils/processDocInfos.ts

Not used to this plugin but I can help if needed.

BTW, I'd like to have a docusaurus-community org (still waiting for FB approval), and move existing popular community plugins to it so that they can be more easily maintained, let me know if you would be ok with that. Having admin access on Github/NPM would allow me to keep the code in sync with Docusaurus core and ensure there's no such issues (or at least I'll be able to fix them rapidly)

from docusaurus-search-local.

weareoutman avatar weareoutman commented on June 3, 2024

@slorber Thanks, that seems would help a lot, I will look into it later.

BTW, I'd like to have a docusaurus-community org (still waiting for FB approval), and move existing popular community plugins to it so that they can be more easily maintained, let me know if you would be ok with that. Having admin access on Github/NPM would allow me to keep the code in sync with Docusaurus core and ensure there's no such issues (or at least I'll be able to fix them rapidly)

This sounds good, and I am personally ok with that. Although this plugin is maintained by myself, but the ownership of this project belongs to my company, so it needs approval. Let me know when the docusaurus-community gets progressed, I'd like to help.

from docusaurus-search-local.

weareoutman avatar weareoutman commented on June 3, 2024

@sdirix try "@easyops-cn/docusaurus-search-local": "^0.19.0"

from docusaurus-search-local.

slorber avatar slorber commented on June 3, 2024

Thanks :) will try to get this org setup but it's not my decision and it may take some additional time. Will ping plugin authors once we have it

from docusaurus-search-local.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.