Add order by

This commit is contained in:
Florian RICHER 2024-02-18 15:56:22 +01:00
parent 1377be120e
commit 909c28050a
4 changed files with 10 additions and 86 deletions

View file

@ -1,8 +1,8 @@
---
image_path: "https://upload.wikimedia.org/wikipedia/commons/thumb/1/11/Test-Logo.svg/783px-Test-Logo.svg.png?20150906031702"
image_path: "https://community.kde.org/images.community/thumb/a/af/Mascot_konqi-base-plasma.png/250px-Mascot_konqi-base-plasma.png"
slug: kde_first_conf
title: Mes premières contributions à KDE
date: 2023-11-26T00:00:00Z
date: 2024-01-12T00:00:00Z
description: Ma première configuration et ma première contribution à l'environnement mobile (Plasma-Mobile).
project_link: none
draft: true

View file

@ -1,78 +0,0 @@
---
image_path: "https://upload.wikimedia.org/wikipedia/commons/thumb/1/11/Test-Logo.svg/783px-Test-Logo.svg.png?20150906031702"
slug: test_layout
title: Testing layout
date: 2023-11-26T00:00:00Z
description: Testing the layout of the site.
project_link: none
draft: true
tags:
- test
---
# Heading 1
## Heading 2
### Heading 3
#### Heading 4
##### Heading 5
###### Heading 6
This is a paragraph tag. It's used `for` displaying text content.
[Click me to visit Example website!](https://www.example.com)
Unordered list
* Item 1
* Item 2
* Item 3
Ordered list
1. Item 1
2. Item 2
3. Item 3
> It's probably important that images look okay here by default as well:
<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/1/11/Test-Logo.svg/783px-Test-Logo.svg.png?20150906031702">
### Code Blocks
```python
def hello_world():
print("Hello World!")
```
```rust
fn main() {
println!("Hello World!");
}
```
```javascript
function helloWorld() {
console.log("Hello World!");
}
```
```ruby
def hello_world
puts "Hello World!"
end
```
```dockerfile
FROM rust
RUN cargo build --release
CMD ["./target/release/hello_world"]
```
```mermaid
graph TD;
A-->B;
A-->C;
B-->D;
C-->D;
```

View file

@ -1,7 +1,5 @@
mod post;
pub use post::{Post, PostMetadata};
cfg_if::cfg_if! {
if #[cfg(feature = "ssr")] {
use std::collections::HashMap;
@ -16,8 +14,10 @@ cfg_if::cfg_if! {
impl Data {
#[allow(dead_code)] // Use in main.rs
pub fn new() -> anyhow::Result<Self> {
let posts = crate::app::utils::data_src::get_all::<Post>("posts")?
.into_iter()
let mut posts = crate::app::utils::data_src::get_all::<Post>("posts")?;
posts.sort_by(|post, post2| post2.metadata.date.cmp(&post.metadata.date));
let posts = posts.into_iter()
.map(Arc::new)
.collect::<Vec<_>>();
@ -47,4 +47,6 @@ cfg_if::cfg_if! {
}
}
}
pub use post::{Post, PostMetadata};

View file

@ -38,7 +38,7 @@ cfg_if::cfg_if! {
let matter = Matter::<YAML>::new();
let mut post_data = matter
.parse_with_struct::<PostMetadata>(&content)
.ok_or_else(|| PostDeserializationError::InvalidFrontMatter)?;
.ok_or(PostDeserializationError::InvalidFrontMatter)?;
let content = post_data.content;