interactivethings / catalog

Create living style guides using Markdown or React
https://www.catalog.style/
BSD 3-Clause "New" or "Revised" License
1.6k stars 145 forks source link

How to configure public url? #348

Closed equinusocio closed 1 year ago

equinusocio commented 6 years ago

Hi, i have an issue publishing the build folder content under a gh-page.

My gh-page is set to serve all files from the root of the master branch. My gh-page url is:

https://contactlab.github.io/repo-name/

I have an issue with the static js files because they have a path starting with /static/... and i need to make them start with /repo-name/static since using /static return 404. Setting the basePath does not change the generated paths. Any suggestion?

jstcki commented 6 years ago

catalog build --public-url=/repo-name/ should do the trick. Note that the files in catalog/static will end up at /repo-name/, not /repo-name/static/

equinusocio commented 6 years ago

@herrstucki Thank you. The catalog now just run fine, but as you said, static content files now return 404. There is a way to fix this?

The static content is served from https://contactlab.github.io/pages/folder/INTRODUCTION.md instead of https://contactlab.github.io/repo-name/pages/design_system/INTRODUCTION.md.

jstcki commented 6 years ago

For example: catalog/static/foo.jpg should be referenced like /foo.jpg in your Markdown documents, then it should work.

equinusocio commented 6 years ago

mmm i'm just importing some static .md content with the pageLoader()

content: pageLoader("/pages/design_system/INTRODUCTION.md")

Inside the source files the /pages folder is inside /static. When builded, it get moved at the root (as you said). I'm missing something or i'm using it the wrong way?

equinusocio commented 6 years ago

@herrstucki Just fixed by removing the / at the begin -> pageLoader("pages/design_system/INTRODUCTION.md")

jstcki commented 6 years ago

Ok, cool. Sorry for the confusion. I'll have to check if that can be improved or documented better.

maiertech commented 6 years ago

@herrstucki Setting --public-url in the build command works, but it is not intuitive. I first followed the docs and added basePath and useBrowserHistory to my config. basePath should be ignored when running catalog-start and only used for catalog-build. Either way, it would be helpful if the docs mentioned this.