Made tags visible on the front-end, added pinning to both back and front-end
This commit is contained in:
parent
0f81091c0a
commit
840ab94d9c
@ -6,3 +6,4 @@ posted = '22/08/2022'
|
||||
estimated_reading_time = 1
|
||||
author = 'IMK' # feel free to swap with your own name
|
||||
order = 1
|
||||
pinned = true
|
||||
|
21
posts/test1/post.md
Normal file
21
posts/test1/post.md
Normal file
@ -0,0 +1,21 @@
|
||||
# WELCOME TO MY BLOG!!!
|
||||
|
||||
So uh the plan is to update this blog as often as possible as I learn more about rust :3
|
||||
|
||||
Don't expect me to word posts professionally as this is intended to be more of something where I can turn off my mind and write my thoughts down.
|
||||
|
||||
## I aim to post daily though so that's cool
|
||||
|
||||
also this blog was made with a random tutorial from The Medium so yeahhhhhhh I can barely understand the codebase or whatever the fancy term for the source code is
|
||||
|
||||
so uhh have fun and stuff :3
|
||||
|
||||
P.S. I go by IMK, IMKJET on most places (and IMKTHECOOL[x] rarely), It's like capitalized usually but I honestly don't give a fuckkkkkk
|
||||
|
||||
1. number
|
||||
2. list
|
||||
3. test
|
||||
|
||||
- unsorted
|
||||
- yeahhh
|
||||
|
9
posts/test1/post_frontmatter.toml
Normal file
9
posts/test1/post_frontmatter.toml
Normal file
@ -0,0 +1,9 @@
|
||||
title = 'unpinned therefore should be at the bottom'
|
||||
file_name = 'test1'
|
||||
description = 'about this blog and stuff'
|
||||
tags = ["Casual"]
|
||||
posted = '22/08/2022'
|
||||
estimated_reading_time = 1
|
||||
author = 'IMK' # feel free to swap with your own name
|
||||
order = 1
|
||||
pinned = false
|
@ -12,6 +12,7 @@ pub struct Frontmatter {
|
||||
author: String,
|
||||
estimated_reading_time: u32,
|
||||
order: u32,
|
||||
pinned: bool,
|
||||
}
|
||||
|
||||
#[get("/")]
|
||||
@ -62,8 +63,10 @@ fn find_all_frontmatters() -> Result<Vec<Frontmatter>, std::io::Error> {
|
||||
if fm.path().is_file() {
|
||||
let fm_content = fs::read_to_string(fm.path())?;
|
||||
let frontmatter: Frontmatter = toml::from_str::<Frontmatter>(&fm_content).unwrap();
|
||||
|
||||
frontmatters.push(frontmatter);
|
||||
if frontmatter.pinned {
|
||||
frontmatters.insert(0,frontmatter);
|
||||
}else{
|
||||
frontmatters.push(frontmatter);}
|
||||
}
|
||||
}
|
||||
Err(e) => {
|
||||
|
@ -8,6 +8,14 @@ a {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.pinned-false {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.pinned-true {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
a:link{
|
||||
color: white;
|
||||
}
|
||||
|
@ -7,12 +7,13 @@
|
||||
{% for fm in posts %}
|
||||
<a class="mb-3" href="/posts/{{fm.file_name}}">
|
||||
<div class="post">
|
||||
<h2 class="text-2xl font-semibold hover:underline">{{fm.title}}</h2>
|
||||
<h2 class="text-2xl font-semibold hover:underline"> {{fm.title}}</h2><p class="pinned-{{fm.pinned}}">!!</p>
|
||||
<hr>
|
||||
<ul>
|
||||
<li>On: {{fm.posted}}</li>
|
||||
<li>By: {{fm.author}}</li>
|
||||
<li>Reading time:{{fm.estimated_reading_time}} min</li>
|
||||
<li>Tags: {{fm.tags}}</li>
|
||||
</ul>
|
||||
</div>
|
||||
</a>
|
||||
|
Loading…
Reference in New Issue
Block a user