skohub-io / skohub-vocabs

A lightweight tool to publish SKOS Vocabularies
https://skohub.io/
Apache License 2.0
36 stars 25 forks source link

added BASEURL to header.js and nestedList.js #80

Closed sroertgen closed 4 years ago

sroertgen commented 4 years ago

Hello there,

in order for your tool to work on GitHub Pages I had to add an .env.production-File with a BASEURL-setting so that path-prefixes are set the right way. You already included this possibility in your index.js, but I found it missing in header.js and nestedList.js.

I appreciate your project very much! Thank you!

sroertgen commented 4 years ago

I just noticed that there is some more work to do, because the paths to the scripts are not set correctly. Will close it for now

sroertgen commented 4 years ago

Hello, just for clarification:

In order to get it working properly I had to add fetch(pageContext.baseURL + (process.env.BASEURL || '') + getFilePath(conceptSchemeId, 'index')) in Row 25 in App.js and remove (process.env.BASEURL || '') from pathPrefix in gatsby-config.js. Now it works without any errors. If I want to serve the site via GitHub Pages I have to add BASEURL=/name-of-my-repo to the .env-file and to the pathPrefix in gatsby-config,js. Now it works either if its served from the root or some subpage. Sorry for confusion. I updated the branch. If you want to include it into master, I can reopen the request.

Here is a working example: https://sroertgen.github.io/skohub-vocabs/

The idea of this approach is that github action can be triggered with a commit to a vocab-repo and then the GitHub Page gets automatically built up with the latest content. Therefore I put your tool in a Docker-Container and set up a GitHub Action. See here for Dockerfile and GitHub action: https://github.com/sroertgen/skohub-vocabs