added favicon

pull/1/head
kirbylife 2019-12-15 17:24:19 -06:00
parent 96a6e0d639
commit 096e6d4f01
2 changed files with 8 additions and 1 deletions

View File

@ -18,9 +18,11 @@ extern crate tera;
use comrak::{markdown_to_html, ComrakOptions}; use comrak::{markdown_to_html, ComrakOptions};
use controllers::{get_post, get_posts, MAX_POSTS_PER_PAGE}; use controllers::{get_post, get_posts, MAX_POSTS_PER_PAGE};
use misc::get_context; use misc::get_context;
use rocket::response::NamedFile;
use rocket::Request; use rocket::Request;
use rocket_contrib::serve::StaticFiles; use rocket_contrib::serve::StaticFiles;
use rocket_contrib::templates::Template; use rocket_contrib::templates::Template;
use std::path::Path;
use std::vec::Vec; use std::vec::Vec;
#[get("/?<page>")] #[get("/?<page>")]
@ -72,10 +74,15 @@ fn not_found_404(req: &Request) -> Template {
Template::render("404", context) Template::render("404", context)
} }
#[get("/favicon.ico")]
fn favicon() -> Option<NamedFile> {
NamedFile::open(Path::new("static/favicon.ico")).ok()
}
fn main() { fn main() {
rocket::ignite() rocket::ignite()
.attach(Template::fairing()) .attach(Template::fairing())
.mount("/", routes![index, show_post]) .mount("/", routes![index, show_post, favicon])
.mount("/admin", routes![admin::index]) .mount("/admin", routes![admin::index])
.mount("/static", StaticFiles::from("static")) .mount("/static", StaticFiles::from("static"))
.register(catchers![not_found_404]) .register(catchers![not_found_404])

BIN
static/favicon.ico 100644

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB