bridgetownrb / bridgetown

A next-generation progressive site generator & fullstack framework, powered by Ruby
https://www.bridgetownrb.com
MIT License
1.16k stars 112 forks source link

Making url config optional #745

Closed sandstrom closed 8 months ago

sandstrom commented 1 year ago

Summary

Make the config option (bridgetown.config.yml) called url optional.

Assumes it already isn't optional (some code seems to hint on it being optional).

Motivation

With the 12-factor principles, it's good if a site doesn't necessarily know where it's running.

It's also useful for certain cases, where a single bridgetown site is deployed at multiple domains (URLs).

Technical explanation

A quick search brought up this usage: https://github.com/bridgetownrb/bridgetown/search?q=config.url

The uses aren't that many, maybe some can be removed (e.g. printing URL on boot up), or just print it if set.

Others can raise an exception if it isn't set, for example absolute_url.

There is also some code already treating it as optional, so maybe it is?

https://github.com/bridgetownrb/bridgetown/blob/715cf3a4460952c2f7d7a17f2bde6c2e3d36d6dd/bridgetown-core/lib/bridgetown-core/filters/url_filters.rb#L88

If so, maybe just update the docs to clarify it's optional, and make small modifications here and there when URL is accessed, and in e.g. the doctor code.


Feel free to close if you don't think this makes sense. I don't want to bombard with too many issues.

jaredcwhite commented 8 months ago

We definitely need a site to support referencing via absolute URL, so I don't see this being an optional value.