diff --git a/src/scriptorium/defaults.gleam b/src/scriptorium/defaults.gleam index d4b9a39..3ad4060 100644 --- a/src/scriptorium/defaults.gleam +++ b/src/scriptorium/defaults.gleam @@ -2,6 +2,7 @@ //// blog quickly. import gleam/uri +import gleam/string import scriptorium/compiler import scriptorium/config.{type Configuration, Compiling, Configuration, Rendering} import scriptorium/parser @@ -34,6 +35,14 @@ pub fn default_config( author: config.Author, copyright: String, ) -> Configuration { + + // Drop any trailing slash from the blog URL, otherwise a `blog_url` like + // "https://my.blog.example/" will end up having a root path of "/" instead + // of "". + let blog_url = case string.ends_with(blog_url, "/") { + True -> string.drop_right(blog_url, 1) + False -> blog_url + } let assert Ok(parsed_url) = uri.parse(blog_url) Configuration(