orchidhq / Orchid

Build and deploy beautiful documentation sites that grow with you
https://orchid.run
GNU General Public License v3.0
514 stars 53 forks source link

Automatically infer base URL given the build environment #287

Closed cjbrooks12 closed 4 years ago

cjbrooks12 commented 5 years ago

Right now, base URLs must be defined in the build scripts for each site. When building the site on a known platform, such as Netlify, there are usually several environment variables provided that could be used to automatically set the base URL for the site.

Currently, Orchid is hard-coded to set the base URL to localhost:8080 when running in serve mode, but this will open that up to no longer be hard-coded, and allow plugins to customize that base URL as well. These should only take effect if the user has not manually set the base URL.

Once that's set up, we can make some assumptions in the "integration" plugins to load the base URL for that environment, starting with Netlify. Other supported platforms might be for Github Actions to publish to the default Github Pages URL, and Gitlab CI for Gitlab Pages.