diff --git a/README.md b/README.md index d9ffb7e..34ef065 100644 --- a/README.md +++ b/README.md @@ -98,5 +98,6 @@ Options - `-p `, `--port ` — Specify the port for the server to listen on [default: 8080] -- `-T `, `--title <TITLE>` — Specify the site name to include in the - `<title>`s of HTML pages for collections +- `-T <TITLE>`, `--title <TITLE>` — Specify the site name to use in HTML/web + views of collections (used inside `<title>`'s and as the root breadcrumb + text) [default: dandidav] diff --git a/src/dav/html.rs b/src/dav/html.rs index 0e37270..899e126 100644 --- a/src/dav/html.rs +++ b/src/dav/html.rs @@ -69,7 +69,7 @@ impl CollectionContext { let full_title = format!("{title} \u{2014} {title_path}"); CollectionContext { title: full_title, - breadcrumbs: make_breadcrumbs(pathparts), + breadcrumbs: make_breadcrumbs(title, pathparts), rows, package_url: env!("CARGO_PKG_REPOSITORY"), package_version: env!("CARGO_PKG_VERSION"), @@ -185,11 +185,11 @@ fn maybe_timestamp<S: Serializer>( } } -fn make_breadcrumbs(pathparts: Vec<Component>) -> Vec<Link> { +fn make_breadcrumbs(title: &str, pathparts: Vec<Component>) -> Vec<Link> { let mut links = Vec::with_capacity(pathparts.len().saturating_add(1)); let mut cumpath = String::from("/"); links.push(Link { - name: String::from("dandidav"), + name: title.to_owned(), href: Href::from_path(&cumpath), }); for p in pathparts { diff --git a/src/main.rs b/src/main.rs index 4813d90..9e9d6f3 100644 --- a/src/main.rs +++ b/src/main.rs @@ -54,7 +54,7 @@ struct Arguments { #[arg(short, long, default_value_t = 8080)] port: u16, - /// Site name to include in HTML page titles + /// Site name to use in HTML collection pages #[arg(short = 'T', long, default_value = env!("CARGO_PKG_NAME"))] title: String, } diff --git a/src/testdata/render-collection/basic.html b/src/testdata/render-collection/basic.html index 17a59da..80f5912 100644 --- a/src/testdata/render-collection/basic.html +++ b/src/testdata/render-collection/basic.html @@ -6,7 +6,7 @@ </head> <body> <div class="breadcrumbs"> - <a href="/">dandidav</a> / + <a href="/">Dandidav Test</a> / <a href="/foo/">foo</a> / <a href="/foo/bar/">bar</a> / <a href="/foo/bar/baz/">baz</a> diff --git a/src/testdata/render-collection/root.html b/src/testdata/render-collection/root.html index 55a4e5d..4a68926 100644 --- a/src/testdata/render-collection/root.html +++ b/src/testdata/render-collection/root.html @@ -6,7 +6,7 @@ </head> <body> <div class="breadcrumbs"> - <a href="/">dandidav</a> + <a href="/">Dandidav Test</a> </div> <table class="collection"> <tr>