No longer ordering links randomly, adding dates to posts

This commit is contained in:
Awstin 2025-02-11 07:06:44 -05:00
parent 34275031b5
commit 623a157504
4 changed files with 3 additions and 13 deletions

View file

@ -6,7 +6,7 @@ use axum::{
routing::{get, post, Router},
Extension,
};
use rand::{seq::SliceRandom, thread_rng, RngCore, SeedableRng};
use rand::{RngCore, SeedableRng};
use rand_chacha::ChaCha8Rng;
use rand_core::OsRng;
use sqlx::PgPool;
@ -149,8 +149,7 @@ pub async fn get_links_as_list(
Err(_) => Vec::new(),
};
let mut rng = thread_rng();
links.shuffle(&mut rng);
links.sort_by(|a, b| b.date_added.cmp(&a.date_added));
let list: Vec<Link> = links
.into_iter()

View file

@ -9,11 +9,6 @@
Places away from the noise of the modern web, without advertisement or trackers.
Following links through these is how I spend most of my time online these days.
</p>
<p>
Links may not be in the same order on each page load.
The list gets randomly shuffled each time to expose new links at the top to visitors.
Just an idea that I had, please <a href="/contact">contact me</a> if it causes anyone issues.
</p>
<ul class="no-bul">
{% for blog in blogs %}
<li><a href={{blog.url}}>{{blog.title}}</a>

View file

@ -3,10 +3,6 @@
{% block content %}
<h2>Links</h2>
<p>
A collection of links to interesting posts that I have found.
In a random order to shuffle what links are at the top.
</p>
<ul class="no-bul">
{% for article in articles %}
<li><a href={{article.url}}>{{article.title}}</a>

View file

@ -4,7 +4,7 @@
{% block content %}
<ul class="no-bul">
{% for article in articles %}
<li><a href="/posts/{{article.reference}}">{{article.title}}</a></li>
<li><a href="/posts/{{article.reference}}">{{article.date}} {{article.title}}</a></li>
{% endfor %}
</ul>
{% endblock %}