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

Add option to deploy to subfolders #5

Open
tothambrus11 opened this issue Jun 26, 2024 · 1 comment
Open

Add option to deploy to subfolders #5

tothambrus11 opened this issue Jun 26, 2024 · 1 comment
Labels
website generation Issues related to the backend (generating the static site)

Comments

@tothambrus11
Copy link
Collaborator

tothambrus11 commented Jun 26, 2024

Currently, the website generation assumes the project will be deployed to a domain's root. However, many people want to host their documentation in a subfolder, like https://example.com/docs, in which case all our absolute references would break, e.g. src="/assets/style.css".

There are multiple solutions:

  • Adding support for setting a base url in the CLI, and use html's meta base tag to define the base url. After that, all relative urls would be resolved from that base, probably also inside css files.
  • Outputting relative urls everywhere, that correctly reference the targets. This requires computing the relative urls from every html file to every target that is being referred to, and the css references would probably not work unless we generate the parts of the css inside the html that are referencing assets (e.g. background: url(../../../assets/icons/copy.svg). This would be very convenient from the user side, as they wouldn't need to worry about setting base urls, they could even open up the website from their file browser without the need for a web server. It would only be possible to do after we have migrated away from Stencil, the html templating library that we are using, because if we need to regenerate the navigation side panel for all html files, it takes over 2 minutes to export documentation for the standard library.
@tothambrus11 tothambrus11 added the website generation Issues related to the backend (generating the static site) label Jun 26, 2024
@ParadoxPixel
Copy link
Collaborator

I think some other solutions would be:

  • Always use the TargetResolver.url(to:) method when we want a URL to refer to a specific target. That way we would be able to modify this method to offset URLs with a base URL as suggested to allow for deploying the documentation to a subfolder. Right now this method is used mostly when referring to a target other than the current target when rendering a page.
  • Rather than providing the Exporter with the base URL to the export path we could split the url property of ResolvedTarget into exportUrl and targetUrl or something similar where the refers to the actual file location relative to the export path and the URL on the website with the subfolder path respectively.

The second option might make it more difficult to keep a proper separation of concerns and not to bloat the ResolvedTarget / resolution step.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
website generation Issues related to the backend (generating the static site)
Projects
None yet
Development

No branches or pull requests

2 participants