diff --git a/src/main.rs b/src/main.rs index 5e6a922..2bcd7be 100644 --- a/src/main.rs +++ b/src/main.rs @@ -18,9 +18,11 @@ extern crate tera; use comrak::{markdown_to_html, ComrakOptions}; use controllers::{get_post, get_posts, MAX_POSTS_PER_PAGE}; use misc::get_context; +use rocket::response::NamedFile; use rocket::Request; use rocket_contrib::serve::StaticFiles; use rocket_contrib::templates::Template; +use std::path::Path; use std::vec::Vec; #[get("/?")] @@ -72,10 +74,15 @@ fn not_found_404(req: &Request) -> Template { Template::render("404", context) } +#[get("/favicon.ico")] +fn favicon() -> Option { + NamedFile::open(Path::new("static/favicon.ico")).ok() +} + fn main() { rocket::ignite() .attach(Template::fairing()) - .mount("/", routes![index, show_post]) + .mount("/", routes![index, show_post, favicon]) .mount("/admin", routes![admin::index]) .mount("/static", StaticFiles::from("static")) .register(catchers![not_found_404]) diff --git a/static/favicon.ico b/static/favicon.ico new file mode 100644 index 0000000..a1695e2 Binary files /dev/null and b/static/favicon.ico differ