stuff
This commit is contained in:
parent
3895837b7a
commit
17e892a654
9 changed files with 63 additions and 5 deletions
45
.vscode/launch.json
vendored
Normal file
45
.vscode/launch.json
vendored
Normal file
|
@ -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}"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
9
.vscode/settings.json
vendored
Normal file
9
.vscode/settings.json
vendored
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
{
|
||||||
|
"spellright.language": [
|
||||||
|
"sv"
|
||||||
|
],
|
||||||
|
"spellright.documentTypes": [
|
||||||
|
"latex",
|
||||||
|
"plaintext"
|
||||||
|
]
|
||||||
|
}
|
|
@ -17,6 +17,7 @@ pub async fn view(Path(path): Path<String>, Extension(state): Extension<Arc<Stat
|
||||||
|
|
||||||
#[cached(time = 60, key = "String", convert = r"{ path.to_owned() }")]
|
#[cached(time = 60, key = "String", convert = r"{ path.to_owned() }")]
|
||||||
async fn render_post(state: &State, path: &str) -> Option<String> {
|
async fn render_post(state: &State, path: &str) -> Option<String> {
|
||||||
|
info!("Rendering post...");
|
||||||
let post = state.posts.iter().find(|p| p.slug == path)?;
|
let post = state.posts.iter().find(|p| p.slug == path)?;
|
||||||
|
|
||||||
let options = Options::all();
|
let options = Options::all();
|
||||||
|
|
|
@ -69,10 +69,11 @@ async fn main() -> Result<()> {
|
||||||
|
|
||||||
let app = Router::new()
|
let app = Router::new()
|
||||||
.route("/", get(handlers::index))
|
.route("/", get(handlers::index))
|
||||||
.route("/posts/", get(handlers::posts::index))
|
.nest("/posts", Router::new()
|
||||||
.route("/posts/:path/", get(handlers::posts::view))
|
.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"))
|
.nest_service("/static", tower_http::services::ServeDir::new("./static"))
|
||||||
.fallback_service(tower_http::services::ServeDir::new("./"))
|
|
||||||
.layer(middleware);
|
.layer(middleware);
|
||||||
|
|
||||||
info!("Now listening at http://localhost:8180");
|
info!("Now listening at http://localhost:8180");
|
||||||
|
|
BIN
static/avatar.png
Normal file
BIN
static/avatar.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.2 KiB |
|
@ -9,6 +9,7 @@
|
||||||
<main>
|
<main>
|
||||||
{% block main %}{% endblock main %}
|
{% block main %}{% endblock main %}
|
||||||
</main>
|
</main>
|
||||||
|
<hr>
|
||||||
<footer>
|
<footer>
|
||||||
{% include "partials/footer.html" %}
|
{% include "partials/footer.html" %}
|
||||||
</footer>
|
</footer>
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
<div><p>footer stuff goes here</p></div>
|
<p>footer stuff goes here</p>
|
|
@ -3,5 +3,6 @@
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<link rel="stylesheet" href="/static/site.css">
|
<link rel="stylesheet" href="/static/site.css">
|
||||||
|
<link rel="icon" href="/static/avatar.png" />
|
||||||
<title>Document</title>
|
<title>Document</title>
|
||||||
</head>
|
</head>
|
Loading…
Reference in a new issue