diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..5d7ad14 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,45 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "type": "lldb", + "request": "launch", + "name": "Debug executable 'website'", + "cargo": { + "args": [ + "build", + "--bin=website", + "--package=website" + ], + "filter": { + "name": "website", + "kind": "bin" + } + }, + "args": [], + "cwd": "${workspaceFolder}" + }, + { + "type": "lldb", + "request": "launch", + "name": "Debug unit tests in executable 'website'", + "cargo": { + "args": [ + "test", + "--no-run", + "--bin=website", + "--package=website" + ], + "filter": { + "name": "website", + "kind": "bin" + } + }, + "args": [], + "cwd": "${workspaceFolder}" + } + ] +} \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..718e72c --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,9 @@ +{ + "spellright.language": [ + "sv" + ], + "spellright.documentTypes": [ + "latex", + "plaintext" + ] +} \ No newline at end of file diff --git a/src/handlers/posts.rs b/src/handlers/posts.rs index fc3913e..5efc99d 100644 --- a/src/handlers/posts.rs +++ b/src/handlers/posts.rs @@ -17,6 +17,7 @@ pub async fn view(Path(path): Path, Extension(state): Extension Option { + info!("Rendering post..."); let post = state.posts.iter().find(|p| p.slug == path)?; let options = Options::all(); diff --git a/src/main.rs b/src/main.rs index 30d1d2d..df64ffd 100644 --- a/src/main.rs +++ b/src/main.rs @@ -69,10 +69,11 @@ async fn main() -> Result<()> { let app = Router::new() .route("/", get(handlers::index)) - .route("/posts/", get(handlers::posts::index)) - .route("/posts/:path/", get(handlers::posts::view)) + .nest("/posts", Router::new() + .route("/", get(handlers::posts::index)) + .route("/:route/", get(handlers::posts::view)) + .fallback_service(tower_http::services::ServeDir::new("./posts"))) .nest_service("/static", tower_http::services::ServeDir::new("./static")) - .fallback_service(tower_http::services::ServeDir::new("./")) .layer(middleware); info!("Now listening at http://localhost:8180"); diff --git a/static/avatar.png b/static/avatar.png new file mode 100644 index 0000000..8e107a0 Binary files /dev/null and b/static/avatar.png differ diff --git a/templates/base.html b/templates/base.html index f7608dd..0c1c572 100644 --- a/templates/base.html +++ b/templates/base.html @@ -9,6 +9,7 @@
{% block main %}{% endblock main %}
+
{% include "partials/footer.html" %}
diff --git a/templates/partials/footer.html b/templates/partials/footer.html index 9c5cc0d..7a80ace 100644 --- a/templates/partials/footer.html +++ b/templates/partials/footer.html @@ -1 +1 @@ -

footer stuff goes here

\ No newline at end of file +

footer stuff goes here

\ No newline at end of file diff --git a/templates/partials/head.html b/templates/partials/head.html index 3e2c07e..80b7145 100644 --- a/templates/partials/head.html +++ b/templates/partials/head.html @@ -3,5 +3,6 @@ + Document \ No newline at end of file diff --git a/templates/partials/header.html b/templates/partials/header.html index 0062155..341c03d 100644 --- a/templates/partials/header.html +++ b/templates/partials/header.html @@ -1,3 +1,3 @@ \ No newline at end of file +