Skip to content

Fix generated links

jon r requested to merge fix/83-generated-links into dev

This brings little changes in tone to the README, plus a fix for generating URLs.

The application now also respects --site parameter (including and without trailing slash) when generating URLs. This means that from now on we always have to specify the --site parameter, unless we are building the production deployment for https://ecobytes.net, as defined in the Astro config.

This is achieved by few conventions:

  • The baseUrl does never end with a slash, no matter which --base is passed.
  • The --base parameter always begins and ends with a slash (default /).
  • Parameters to the url() helper function always begin with a slash.
  • Links to the root of the project (/) always end in a slash, no matter if located at the main site domain, or in a sub path at a different base of the site.

In general, Node land has enough to say about joining URL path fragments, and offers additional packages for this functionality.

References about joining URLs with Node.js / TypeScript

We're working around this by carefully crafting the baseUrl with passing through a new URL, but also with having all links appear relative to the / root of the site.

Closes #83 (closed)

Edited by jon r

Merge request reports