added favicon
parent
96a6e0d639
commit
096e6d4f01
|
@ -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("/?<page>")]
|
||||
|
@ -72,10 +74,15 @@ fn not_found_404(req: &Request) -> Template {
|
|||
Template::render("404", context)
|
||||
}
|
||||
|
||||
#[get("/favicon.ico")]
|
||||
fn favicon() -> Option<NamedFile> {
|
||||
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])
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 1.4 KiB |
Loading…
Reference in New Issue