grnet / docusaurus-terminology

Home of Docusaurus Terminology Plugin
BSD 2-Clause "Simplified" License
35 stars 5 forks source link

baseUrl does not seem to be applied to urls in the glossary #2

Closed userdocs closed 1 year ago

userdocs commented 1 year ago

Sorry, i meant to provide a comment before posting. With this config,

  plugins: [
    [
      "@grnet/docusaurus-terminology",
      {
        termsDir: "./docs/terms",
        docsDir: "./docs/",
        glossaryFilepath: "./docs/glossary.md",
      },
    ],
  ],

The generated glossary is using the default URLS and not my baseUrl which means they don't resolve. I did see this

https://github.com/grnet/docusaurus-terminology/blob/e432ace33b144d5e5e7bd08f35a0fc207982f588/plugins/docusaurus-terminology/index.js#L21

It looks like it should, right?

tsironis commented 1 year ago

This should be fixed in the latest 1.0.0-rc.2 version.

szklany commented 1 year ago

Hi @tsironis ,

I'm using version 1.0.0 and I'm still seeing this error. The links on the glossary page simply point to http://docs/terms/{file name}. This problem is not there on the regular pages. Clicking on one of the links shows the following error:

Uncaught runtime errors:
×
ERROR
Failed to execute 'pushState' on 'History': A history state object with URL 'http://docs/terms/{file name}' cannot be created in a document with origin 'http://localhost:3000' and URL 'http://localhost:3000/docs/glossary'.
    at eval (webpack-internal:///./node_modules/history/esm/history.js:372:23)
    at Object.confirmTransitionTo (webpack-internal:///./node_modules/history/esm/history.js:157:9)
    at push (webpack-internal:///./node_modules/history/esm/history.js:365:23)
    at navigate (webpack-internal:///./node_modules/react-router-dom/esm/react-router-dom.js:221:9)
    at onClick (webpack-internal:///./node_modules/react-router-dom/esm/react-router-dom.js:176:11)
    at HTMLUnknownElement.callCallback (webpack-internal:///./node_modules/react-dom/cjs/react-dom.development.js:3945:14)
    at Object.invokeGuardedCallbackDev (webpack-internal:///./node_modules/react-dom/cjs/react-dom.development.js:3994:16)
    at invokeGuardedCallback (webpack-internal:///./node_modules/react-dom/cjs/react-dom.development.js:4056:31)
    at invokeGuardedCallbackAndCatchFirstError (webpack-internal:///./node_modules/react-dom/cjs/react-dom.development.js:4070:25)
    at executeDispatch (webpack-internal:///./node_modules/react-dom/cjs/react-dom.development.js:8243:3)
ERROR
Failed to execute 'pushState' on 'History': A history state object with URL 'http://docs/terms/{file name}' cannot be created in a document with origin 'http://localhost:3000' and URL 'http://localhost:3000/docs/glossary'.
    at eval (webpack-internal:///./node_modules/history/esm/history.js:372:23)
    at Object.confirmTransitionTo (webpack-internal:///./node_modules/history/esm/history.js:157:9)
    at push (webpack-internal:///./node_modules/history/esm/history.js:365:23)
    at navigate (webpack-internal:///./node_modules/react-router-dom/esm/react-router-dom.js:221:9)
    at onClick (webpack-internal:///./node_modules/react-router-dom/esm/react-router-dom.js:176:11)
    at HTMLUnknownElement.callCallback (webpack-internal:///./node_modules/react-dom/cjs/react-dom.development.js:3945:14)
    at Object.invokeGuardedCallbackDev (webpack-internal:///./node_modules/react-dom/cjs/react-dom.development.js:3994:16)
    at invokeGuardedCallback (webpack-internal:///./node_modules/react-dom/cjs/react-dom.development.js:4056:31)
    at invokeGuardedCallbackAndCatchFirstError (webpack-internal:///./node_modules/react-dom/cjs/react-dom.development.js:4070:25)
    at executeDispatch (webpack-internal:///./node_modules/react-dom/cjs/react-dom.development.js:8243:3)

Is there a workaround for this?

szklany commented 1 year ago

Ahh I just noticed that it seems to only not work when developing on localhost. After deploying everything is fine.