Skip to content

Commit

Permalink
fix: fixes for errors in 2.5
Browse files Browse the repository at this point in the history
  • Loading branch information
Nereuxofficial committed Jul 24, 2024
1 parent e33e6d1 commit 2ff0fa7
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 28 deletions.
43 changes: 21 additions & 22 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "duckblog"
version = "0.2.0"
version = "0.2.5"
edition = "2021"
rust-version = "1.70.0"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Expand Down
4 changes: 2 additions & 2 deletions liquid/header.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@
<meta property="og:locale" content="en-us">
<meta property="og:site_name" content="DuckBlog">
<link href="https://nereux.blog/feed.xml" type="application/atom+xml" rel="alternate" title="Sitewide Atom feed">
{% if metadata.images %}
{% unless metadata.images == empty %}
<meta property="og:image" content="https://nereux.blog/{{ metadata.images[0] }}">
{% endif %}
{% endunless %}
<style>
h2 {
font-size: 2rem;
Expand Down
2 changes: 1 addition & 1 deletion liquid/index.html.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
{% for post in posts %}
<div class="flex-column text-center my-10">
<h2 class="text-4xl font-bold mb-0 text-green-500">
<a href="/{{ post.path }}">
<a href="{{ post.path }}">
{{ post.metadata.title }}</a>
</h2>
<p class="text-gray-500 text-sm mb-0">{{ post.metadata.date }}</p>
Expand Down
4 changes: 2 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ async fn get_about() -> impl IntoResponse {
async fn get_post(Path(path): Path<String>) -> impl IntoResponse {
if !path.ends_with('/') {
// Workaround for wrong image paths, breaks /about
return Redirect::to(format!("/posts_map/{}/", path).as_str()).into_response();
return Redirect::to(format!("/posts/{}/", path).as_str()).into_response();
}
// Remove trailing slash
let path = format!("/posts/{}", path.trim_end_matches('/'));
Expand Down Expand Up @@ -260,7 +260,7 @@ async fn get_post(Path(path): Path<String>) -> impl IntoResponse {
#[instrument]
async fn list_posts(Path(path): Path<String>) -> impl IntoResponse {
info!("Listing posts with filter: {:#?}", path);
let mut posts = Post::parse_all_posts().await.unwrap();
let mut posts = POSTS.get().unwrap().values().cloned().collect::<Vec<Post>>();
if !path.is_empty() {
posts.retain(|post| post.metadata.tags.iter().any(|tag| tag == &path));
}
Expand Down

0 comments on commit 2ff0fa7

Please sign in to comment.