Skip to content

An origin option for features that need absolute URLs #180

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

Open
Fil opened this issue Nov 15, 2023 · 7 comments
Open

An origin option for features that need absolute URLs #180

Fil opened this issue Nov 15, 2023 · 7 comments
Labels
enhancement New feature or request

Comments

@Fil
Copy link
Contributor

Fil commented Nov 15, 2023

For anything that needs absolute URLs (#168, #178, #179).

The 404.html page (#174) should also somehow be aware of the server's root (does not need the host option, but the base) if we want to use the same file to serve 404s both at paths containing any sub/paths/ from the home page.(or maybe not, see #194 (comment)).

See also discussion under #42.

@Fil Fil added the enhancement New feature or request label Nov 15, 2023
@mbostock mbostock added this to the Future milestone Nov 15, 2023
@mbostock
Copy link
Member

I don’t think this should be a command-line flag. It should be a config option.

@mbostock mbostock changed the title support --host A host option for features that need absolute URLs Nov 15, 2023
@mbostock
Copy link
Member

mbostock commented Mar 7, 2024

Does the existing base option work for this?

@Fil
Copy link
Contributor Author

Fil commented Mar 7, 2024

We could choose to make it work, for example when this option is specified as a URL it could be applied to all pages, not only the 404. But we'd need to change the relative paths (as they would now be relative to the base, not to the page). It feels like a different concern (or concept), in that what we need here is the URL of the root of the site. "host", as this was titled, is not enough.

@Fil Fil changed the title A host option for features that need absolute URLs A root url option for features that need absolute URLs Mar 7, 2024
@mbostock
Copy link
Member

mbostock commented Mar 7, 2024

I didn’t mean to add a <base> everywhere. I meant to use the base value to compute an absolute path as needed. But not enough if you need the origin (host) too I guess.

@Fil
Copy link
Contributor Author

Fil commented Mar 7, 2024

Oh I see… yes I think you're correct: if the base is an absolute URL, it would have that slightly new meaning (URL of the root of the site) and still be compatible with how we use it for 404.html.

@mbostock
Copy link
Member

mbostock commented Mar 7, 2024

it would have that slightly new meaning (URL of the root of the site)

I thought that’s what it meant. 😅 The docs say “the base path when serving the site.” Or are you saying that “base” would then have “https://…” in it? I didn’t mean that. I just meant enough to compute the absolute path. If we need the absolute URL including the origin then we should add a new config property such as origin.

@Fil
Copy link
Contributor Author

Fil commented Mar 7, 2024

ok, so the formula would be root url = origin + base, with origin = 'https://user.observablehq.cloud' and base = '/project-name/'?

(this is what this issue was about originally [but not explicit enough, and the option was called host]).

@Fil Fil changed the title A root url option for features that need absolute URLs An origin option for features that need absolute URLs Mar 11, 2024
@mbostock mbostock removed this from the Future milestone Mar 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants