feat: add title and description for website in html

This commit is contained in:
Kilerd Chan 2018-10-10 20:37:45 +08:00
parent aec1136e9c
commit a519cfa5e4
2 changed files with 4 additions and 4 deletions

View File

@ -46,7 +46,7 @@ fn index(conn: DbConn) -> Template {
fn single_archives(conn: DbConn, archives_id: i32) -> Result<Template, Failure> {
let mut context = Context::new();
let result: Result<_,_> = posts.find(archives_id).first::<Post>(&*conn);
let result: Result<_, _> = posts.find(archives_id).first::<Post>(&*conn);
if let Err(_err) = result {
return Err(Failure(Status::NotFound));
@ -77,7 +77,7 @@ fn static_content(file: PathBuf) -> Result<NamedFile, Failure> {
}
#[catch(404)]
fn not_found_catcher() -> String{
fn not_found_catcher() -> String {
"not found".to_string()
}
@ -89,7 +89,6 @@ fn main() {
rocket::ignite()
.catch(catchers![not_found_catcher])
.manage(pg_pool::init(&database_url))
// .mount("/statics", StaticFiles)
.mount("/", routes![index, single_archives, static_content])
.attach(Template::fairing())
.launch();

View File

@ -1,7 +1,8 @@
{% extends "base" %}
{% block body %}
<h1>Rubble</h1>
<p>description of rubble application</p>
{% for post in posts %}
<div>
<a href="/archives/{{ post.id }}">{{ post.title }}</a>