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

baseURL behavior #1081

Closed
1 task done
noraj opened this issue Nov 1, 2018 · 4 comments
Closed
1 task done

baseURL behavior #1081

noraj opened this issue Nov 1, 2018 · 4 comments

Comments

@noraj
Copy link
Contributor

noraj commented Nov 1, 2018

🐛 Bug Report

I don't know if it is related with #448 but I don't think that baseURL in siteConfig.js has the right behavior or I don't understand it.

I understand that one have to put this config if the documentation is directly accessed under https://rawsec.gitlab.io/':

  • url: 'https://rawsec.gitlab.io'
  • baseUrl: '/'

or to put this configuration if the documentation is accessed from a sub-directory like https://rawsec.gitlab.io/rawsec-cybersecurity-inventory-doc/:

  • url: 'https://rawsec.gitlab.io'
  • baseUrl: '/rawsec-cybersecurity-inventory-doc/'

A lot of project behave like that but then they generate the website directly under the build/ directory where Docusaurus is generating it under build/rawsec-cybersecurity-inventory-doc/ creating an extra sub-folder.

So in a CI/CD that auto-deploy the website, if one is doing cp -rT build/rawsec-cybersecurity-inventory-doc/ ../public he will have public/ in the end (we are force to use -T, --no-target-directory or globbing to avoidrawsec-cybersecurity-inventory-doc/ to be copied and resulting in public/rawsec-cybersecurity-inventory-doc/ so the doc would be served under https://rawsec.gitlab.io/rawsec-cybersecurity-inventory-doc/rawsec-cybersecurity-inventory-doc/).

This is forcing us to put rawsec-cybersecurity-inventory-doc/ in the CI file. So if the URL change because the gitlab project/repository is renamed we will have to modify the CI too.

So how I see it is: not creating an extra directory under build/.

I don't really get why the extra directory is created, maybe for people that serve the doc themselves under something like /var/www/html/ so copying build they will already have rawsec-cybersecurity-inventory-doc/ created. But for hosting under Gitlab Pages (maybe same behavior with Github pages and an external CI) this force people to be very careful on how they copy build/.

Of course this won't be a problem for people using publish-gh-pages script. But this is a particular and manual case, where using a CI/CD is a more automated and generic case.

So ok this is a very minor issue, and I maybe should have put it under question. Sorry for the extensive description but this is difficult to explain.

To Reproduce

Don't really applicable. See the description.

Expected behavior

Generated website is directly placed under build/ folder, no extra sub-directory is created.

Actual Behavior

Generated website is placed under build/baseURLhere/ sub-folder.

Reproducible Demo

See the repo: https://gitlab.com/rawsec/rawsec-cybersecurity-inventory-doc

Update: I included the documentation in my current repository instead of having a separate repository: https://gitlab.com/rawsec/rawsec-cybersecurity-list/

@noraj
Copy link
Contributor Author

noraj commented Nov 1, 2018

PS : please take a look at my .gitlab-CI and also give an example for GitLab under https://docusaurus.io/docs/en/publishing.

@noraj
Copy link
Contributor Author

noraj commented Nov 1, 2018

erratum : I just figured that was projectName that was used and not baseURL to create the extra sub-folder.

@yangshun
Copy link
Contributor

yangshun commented Nov 2, 2018

I agree. This is a legacy decision that we'll fix in v2.

@yangshun yangshun closed this as completed Nov 2, 2018
@yangshun yangshun added the v2 label Nov 2, 2018
@noraj
Copy link
Contributor Author

noraj commented Nov 3, 2018

@yangshun Nice to hear.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants